[Whonix-devel] #25140 [Core Tor/Tor]: Parse only .torrc files in torrc.d directory

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Sep 13 16:15:44 CEST 2018


#25140: Parse only .torrc files in torrc.d directory
-------------------------------------------------+-------------------------
 Reporter:  iry                                  |          Owner:
                                                 |  Jigsaw52
     Type:  task                                 |         Status:
                                                 |  needs_revision
 Priority:  High                                 |      Milestone:  Tor:
                                                 |  unspecified
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.3.3.1-alpha
 Severity:  Major                                |     Resolution:
 Keywords:  034-triage-20180328,                 |  Actual Points:
  035-removed-20180711                           |
Parent ID:                                       |         Points:
 Reviewer:  ahf                                  |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by Jigsaw52):

 I was finally able to find time to get back to this.

 In the meantime, there was a big refactoring of the tor code base so I've
 created a new branch based on the code after the refactoring.
 This means that the commit hashes on previous comments are now useless but
 I've added the equivalents on the new branch to the comments.

 The new branch is here: https://github.com/Jigsaw52/tor/commits/torrc-
 include-wildcards-25140_rebased

 For my first 4 commits the code is mostly the same as before just in
 different files. The only change I recall is removing PATH_MAX from
 tor_glob and config tests due to #26873. There are also new commits that
 either address previous mentioned issues or other issues I've found while
 testing.

 Addressing the previous comments:

 > - `edd70916b66fca41fc8aab10893ba731c1b75840` (now
 `7543b9253000e238788d0a209b3b501a5a16be66`:
 >     1. Would it make sense to ensure that the `tor_glob()` function
 works the same way on both Windows and POSIX when glob'ing on directory
 and file? A part of the glob test case is split between Windows and POSIX
 there.

 This has been improved: now wildcards are supported on all path components
 on Windows (commit `8bf917c4d8369bde9be53a6746c532d9932b05f3`) and the
 behavior of the path separator at the end of the path is the same as on
 POSIX (commit `ba8f29f24a353892a1e9dfab397ce543a6d192d3`).

 > - `5aec94bc3bb6623bd8f62aedeca8aaf699a0e8b6` (now
 `fcc7275f5c80214e746bd6778f98af730993d8b2`):
 >     1. In `config_get_file_list()`: Why must the `matches` be sorted
 using `smartlist_sort_strings()`? Shouldn't that happen in the glob
 function then?

 I followed the approach of the existing tor_listdir function which also
 leaves sorting as a responsibility of the caller.
 I do not know if there was a reason for this, but I followed it for
 consistency.

 >     2. I think `config_get_glob_opened_files()` might benefit from
 having some of this logic split into some more functions.

 This has been addressed in commit
 `ba8f29f24a353892a1e9dfab397ce543a6d192d3`: as the Windows version of
 tor_gob ended up sharing much of the code with get_glob_opened_files (due
 to both needing to expand path components with globs manually), all the
 common code has been split into smaller functions.

 Also, I noticed that #27186 is addressed by my first commit
 (`61ee3726caad0aa8399ad07af1fe6eb6aa6aecb2`).

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


More information about the Whonix-devel mailing list