[tor-bugs] #34320 [Applications/Tor Browser]: TMPDIR should be set in rbm so all scripts in tor-browser-build use it if needed (was: fetch-gradle-dependencies should respect tmp_dir)

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri May 29 06:36:28 UTC 2020


#34320: TMPDIR should be set in rbm so all scripts in tor-browser-build use it if
needed
-------------------------------------------------+-------------------------
 Reporter:  gk                                   |          Owner:  boklm
     Type:  defect                               |         Status:
                                                 |  assigned
 Priority:  Medium                               |      Milestone:
Component:  Applications/Tor Browser             |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tbb-rbm, GeorgKoppen202005,          |  Actual Points:
  TorBrowserTeam202005                           |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------
Changes (by gk):

 * status:  needs_revision => assigned
 * owner:  gk => boklm


Comment:

 Replying to [comment:2 boklm]:
 > The problem with using `tmp_dir` there is that the `var/build_id` of
 projects using `fetch-gradle-dependencies` will now depend on the value of
 `tmp_dir`. So for example moving the path of the `tor-browser-build`
 directory (where the default `tmp_dir` is located) will cause those
 projects to be rebuilt.

 Good catch. I think I hit something like that when rebuilding without my
 patch and wondered what happened. :)

 [snip]

 >
 > Alternatively, we could patch rbm to always set `$TMPDIR` when running
 scripts. I think this patch would do that (but I have not tested it yet. I
 can make a real patch if you think that's a good idea.):
 > {{{
 > diff --git a/lib/RBM.pm b/lib/RBM.pm
 > index 7cc9e24..50920af 100644
 > --- a/lib/RBM.pm
 > +++ b/lib/RBM.pm
 > @@ -461,8 +461,9 @@ sub run_script {
 >      my ($project, $cmd, $f) = @_;
 >      $f //= \&capture_exec;
 >      my @res;
 > +    local $ENV{TMPDIR} = get_tmp_dir($project);
 >      if ($cmd =~ m/^#/) {
 > -        my (undef, $tmp) = File::Temp::tempfile(DIR =>
 get_tmp_dir($project));
 > +        my (undef, $tmp) = File::Temp::tempfile(DIR => $ENV{TMPDIR});
 >          path($tmp)->spew_utf8($cmd);
 >          chmod 0700, $tmp;
 >          @res = $f->($tmp);
 > }}}

 That seems like the right approach to me, please do. :) I guess we could
 clean up the `dmg2mar` script then as well?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/34320#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list