Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket30935 merged #1254

Merged
merged 16 commits into from Aug 26, 2019
Merged

Conversation

Labels
None yet
Projects
None yet
4 participants
@nmathewson
Copy link
Contributor

@nmathewson nmathewson commented Aug 22, 2019

No description provided.

nmathewson added 10 commits Jun 25, 2019
The testing-only parts now live in a conftesting.h; the shared parts
of the macros live in confmacros.h
Additionally, adjust the macros so that we can add new members like
this more easily.
"unsettable" is a property of types.  LINELIST_V and OBSOLETE are
unsettable, meaning that they cannot be set by name.

"contained" is a property of types.  I'm hoping to find a better
name here.  LINELIST_S is "contained" because it always appears
within a LINELIST_V, and as such doesn't need to be dumped ore
copied independently.

"cumulative" is a property of types. Cumulative types can appear
more than once in a torrc without causing a warning, because they
add to each other rather than replacing each other.

"obsolete" is a property of variables.

"marking fragile" is now a command that struct members can accept.

With these changes, confparse and config no longer ever need to
mention CONFIG_TYPE_XYZ values by name.
Previously, these were magical things that we detected by checking
whether a variable's name was prefixed with two or three underscores.
Previously, when TestingTorNetwork was set, we would manually adjust
the initvalue members of a bunch of other config_var_t, and then
re-run the early parts or parsing the options.

Now we treat the initvalue fields as immutable, but instead assign
to them in options_init(), as early as possible.  Rather than
re-running the early parts of options, we just re-call the
options_init_from_string() function.

This patch de-kludges some of our code pretty handily.  I think it
could later handle authorities and fallbacks, but for now I think we
should leave those alone.
Now that we have a reasonable implementation for overriding the
default options for TestingTorNetwork, we don't need to modify
config_var_t structs any more.  And therefore, we can have constant
format options, like reasonable people.
This C file will eventually belong in lib/confmgt, so it needs to
have only low-level dependencies.  Now that it no longers needs
routerset.c, we can adjust its includes accordingly.

I'm not moving the file yet, since it would make fixup commits on
earlier branches here really hard to do.
Copy link
Contributor

@teor2345 teor2345 left a comment

It's weird having obsolete / no dump / invisible options, and then flags that do similar things a higher level of abstraction:

contained = no dump, no copy, no check
not settable = no dump?
And then we have obsolete at this level, which means contained.

I feel like there is a better design that has orthogonal flags, at least at the lowest level. And then the higher levels can use combinations of those flags for contained, settable, obsolete, etc.

src/lib/conf/conftesting.h Show resolved Hide resolved
src/lib/conf/confmacros.h Outdated Show resolved Hide resolved
src/app/config/config.c Show resolved Hide resolved
src/app/config/config.c Show resolved Hide resolved
src/app/config/config.c Outdated Show resolved Hide resolved
@@ -642,7 +642,7 @@ config_dump(const config_format_t *fmt, const void *default_options,
continue;
}
/* Don't save 'hidden' control variables. */
Copy link
Contributor

@teor2345 teor2345 Aug 23, 2019

This comment is also confusing, we need to distinguish between "invisible" (no read and no dump) and "hidden" (no dump).

Copy link
Contributor Author

@nmathewson nmathewson Aug 24, 2019

Agreed. Must solve now, or should solve before we call this work finished?

Copy link
Contributor

@teor2345 teor2345 Aug 25, 2019

Should solve before we call #29211 finished.

src/lib/conf/conftypes.h Outdated Show resolved Hide resolved
#define CVFLAG_NODUMP (1u<<1)
/**
* Flag to indicate that an option is "invisible". An invisible option
* is always undumpable, and we don't tell the controller about it.
Copy link
Contributor

@teor2345 teor2345 Aug 23, 2019

Why not keep these options orthogonal, and say "no dump" and "no read"?

Copy link
Contributor Author

@nmathewson nmathewson Aug 24, 2019

Agreed. Blocker for this PR, or blocker for calling Tor#29211 done?

Copy link
Contributor

@teor2345 teor2345 Aug 25, 2019

Should solve before we call #29211 finished.

@@ -110,6 +110,16 @@ typedef struct struct_magic_decl_t {
* fetch this option should produce a warning.
Copy link
Contributor

@teor2345 teor2345 Aug 23, 2019

It's weird having obsolete / no dump / invisible options, and then flags that do similar things a higher level of abstraction:

  • contained = no dump, no copy, no check
  • not settable = no dump?

And then we have obsolete at this level, which means contained.

I feel like there is a better design that has orthogonal flags, at least at the lowest level. And then the higher levels can use combinations of those flags for contained, settable, obsolete, etc.

Copy link
Contributor Author

@nmathewson nmathewson Aug 24, 2019

Agreed. Blocker for this PR, or blocker for calling Tor#29211 done?

Copy link
Contributor

@teor2345 teor2345 Aug 25, 2019

Must solve before we call #29211 finished, otherwise this code will be very hard to modify in future.

scripts/maint/practracker/exceptions.txt Show resolved Hide resolved
@torproject-pusher torproject-pusher merged commit 38c4e14 into torproject:master Aug 26, 2019
0 of 2 checks passed
@coveralls
Copy link

@coveralls coveralls commented Aug 27, 2019

Pull Request Test Coverage Report for Build 5936

  • 45 of 72 (62.5%) changed or added relevant lines in 5 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 62.938%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/lib/confmgt/structvar.c 10 13 76.92%
src/app/config/confparse.c 13 18 72.22%
src/lib/confmgt/typedvar.c 5 11 45.45%
src/app/config/config.c 12 25 48.0%
Files with Coverage Reduction New Missed Lines %
src/app/config/config.c 1 72.89%
src/app/config/confparse.c 1 97.4%
Totals Coverage Status
Change from base Build 5901: 0.02%
Covered Lines: 47384
Relevant Lines: 75287

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment