[tor-bugs] #34320 [Applications/Tor Browser]: TMPDIR should be set in rbm so all scripts in tor-browser-build use it if needed

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun May 31 22:26:33 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:
                                                 |  needs_review
 Priority:  Medium                               |      Milestone:
Component:  Applications/Tor Browser             |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tbb-rbm, GeorgKoppen202005,          |  Actual Points:
  TorBrowserTeam202005R                          |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------
Changes (by boklm):

 * keywords:  tbb-rbm, GeorgKoppen202005, TorBrowserTeam202005 => tbb-rbm,
     GeorgKoppen202005, TorBrowserTeam202005R
 * status:  assigned => needs_review


Comment:

 Replying to [comment:2 boklm]:

 > 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);
 > }}}

 There is a patch for review in branch `bug_34320`:
 https://gitweb.torproject.org/user/boklm/rbm.git/commit/?h=bug_34320&id=c50d8e22c4fcddc4ed567815b1b0135419c2a53c

 Compared to the previous version of the patch we are now using
 `rbm_tmp_dir` instead of `tmp_dir` (which is a directory inside `tmp_dir`
 which is automatically removed when rbm exits). We are also fixing a place
 where the `run_script` function was not used when running a script.

 I checked that TMPDIR is correctly set with the following change:
 {{{
 diff --git a/projects/release/config b/projects/release/config
 index 17db3d0e..50901fc8 100644
 --- a/projects/release/config
 +++ b/projects/release/config
 @@ -202,6 +202,12 @@ input_files:
       - torbrowser-src

  steps:
 +  test_bug34320:
 +    build_log: '-'
 +    input_files: []
 +    test_bug34320: |
 +      #!/bin/bash
 +      echo $TMPDIR
    signtag:
      build_log: '-'
      debug: 0
 }}}
 And this command:
 {{{
 ./rbm/rbm build --step test_bug34320 release
 }}}

 There is also a `tor-browser-build` patch in branch `bug_34320` updating
 rbm and cleaning `dmg2mar`:
 https://gitweb.torproject.org/user/boklm/tor-browser-
 build.git/commit/?h=bug_34320&id=d61aff9cf0f51de9d6fa4a8c9cb5a71e203bce4f

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


More information about the tor-bugs mailing list