[tor-bugs] #31625 [Core Tor/Tor]: config refactoring: fix hierarchy of configuration variable flags

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Sep 4 16:38:14 UTC 2019


#31625: config refactoring: fix hierarchy of configuration variable flags
-----------------------------------------+---------------------------------
 Reporter:  nickm                        |          Owner:  nickm
     Type:  defect                       |         Status:  assigned
 Priority:  Medium                       |      Milestone:  Tor:
                                         |  0.4.2.x-final
Component:  Core Tor/Tor                 |        Version:
 Severity:  Normal                       |     Resolution:
 Keywords:  network-team-roadmap-august  |  Actual Points:
Parent ID:  #29211                       |         Points:  .5
 Reviewer:                               |        Sponsor:
-----------------------------------------+---------------------------------

Comment (by nickm):

 Here's a proposed design -- what do you think?

 == The current situation ==

 Currently we have two kinds of flags:
    * flags for types
    * flags for variables.

 If a flag is set on a type, it applies to every variable of that type.
 If a flag is set on a variable, it applies only to that variable.


 The type flags are:

    unsettable -- cannot be set directly by name. (LINELIST_V, OBSOLETE)

    contained -- addresses part of another type. (LINELIST_S, OBSOLETE)

    cumulative -- setting a variable of this type does not override older
       values set to this type. (all LINELIST, LINELIST_V, LINELIST_S)

 The variable flags are:

    invisible -- does not show up on lists of variables, does not get
 written to disk, and is not visible to the controller.

    obsolete -- produce a warning on any attempt to set or fetch the
 option. Do not list it as a valid option.

    nodump -- do not write to disk.  These are mostly testing options.

 == The refactoring ==

 The new orthogonal low-level options are:

   * NOSET -- cannot be set by name.

   * NOLIST -- does not appear in lists of options.

   * NODUMP -- do not dump this option to disk from config_dump() -- either
 because it is a testing option, or because it is contained in another
 option.

   * NOCOPY -- do not try to copy this option in config_dup, because it is
 contained in another option, or has no storage.

   * NOGET -- cannot be fetched by the controller.

   * CUMULATIVE -- remains unchanged.  We might call it NOREPLACE or
     NOOVERWRITE if that's clearer?

 With this set of options:

   "cumulative" remains CUMULATIVE.

   "nodump" remains "NODUMP".

   "unsettable" becomes NOSET.

   "contained" becomes NODUMP + NOCOPY

   "invisible" becomes NOGET + NOSET + NODUMP + NOLIST

   "obsolete" becomes NOGET + NOSET + NODUMP + NOCOPY + NOLIST.

 == How flags are set ==

 Flags can be set either on a type or on a variable.  Variable flags are
 or'd with the flags of their type before checking them.

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


More information about the tor-bugs mailing list