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

2020-06-01 Thread Tor Bug Tracker & Wiki
#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:  gk   |Sponsor:
-+-
Changes (by gk):

 * reviewer:   => gk


--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs


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

2020-05-31 Thread Tor Bug Tracker & Wiki
#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 //= \_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=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=d61aff9cf0f51de9d6fa4a8c9cb5a71e203bce4f

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs


Re: [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)

2020-05-29 Thread Tor Bug Tracker & Wiki
#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 //= \_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: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs