[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #34320 [Applications/Tor Browser]: fetch-gradle-dependencies should respect tmp_dir



#34320: fetch-gradle-dependencies should respect tmp_dir
-------------------------------------------------+-------------------------
 Reporter:  gk                                   |          Owner:  gk
     Type:  defect                               |         Status:
                                                 |  needs_revision
 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 boklm):

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


Comment:

 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.

 Maybe this can be fixed by resetting `tmp_dir` in `var/build_id`:
 {{{
 diff --git a/rbm.conf b/rbm.conf
 index 628e33dd..c02afb6a 100644
 --- a/rbm.conf
 +++ b/rbm.conf
 @@ -36,7 +36,7 @@ var:
    # in the same order. In the cases where the installation order is
    # important, sort_deps should be set to 0.
    sort_deps: 1
 -  build_id: '[% sha256(c("var/build_id_txt", { buildconf => { num_procs
 => 4 } })).substr(0, 6) %]'
 +  build_id: '[% sha256(c("var/build_id_txt", { buildconf => { num_procs
 => 4 }, tmp_dir => "/tmp" })).substr(0, 6) %]'
    build_id_txt: |
      [% c("version") %]
      [% IF c("git_hash") || c("hg_hash"); GET c("abbrev"); END; %]
 }}}

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

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/34320#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs