[tor-commits] [tor/master] Teach checkOptionDocs about deprecation.
nickm at torproject.org
nickm at torproject.org
Sat Aug 20 00:09:56 UTC 2016
commit 9b6ff4c882431dd9733a1c36fc3a2b662fa5f11a
Author: Nick Mathewson <nickm at torproject.org>
Date: Wed Aug 3 12:15:01 2016 -0400
Teach checkOptionDocs about deprecation.
In particular, teach it that deprecated options must exist.
---
doc/tor.1.txt | 4 ++++
src/or/config.c | 24 +++++++++++++++++++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index b5d6e87..530e8ca 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -84,6 +84,10 @@ COMMAND-LINE OPTIONS
[[opt-list-torrc-options]] **--list-torrc-options**::
List all valid options.
+[[opt-list-deprecated-options]] **--list-deprecated-options**::
+ List all valid options that are scheduled to become obsolete in a
+ future version. (This is a warning, not a promise.)
+
[[opt-version]] **--version**::
Display Tor version and exit.
diff --git a/src/or/config.c b/src/or/config.c
index cf1365a..a5428aa 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -603,9 +603,9 @@ static const config_deprecation_t option_deprecation_notes_[] = {
"fingerprint." },
{ "FastFirstHopPK", "Changing this option does not make your client more "
"secure, but does make it easier to fingerprint." },
- { "CloseHSClientCircutisImmediatelyOnTimeout", "This option makes your "
+ { "CloseHSClientCircuitsImmediatelyOnTimeout", "This option makes your "
"client easier to fingerprint." },
- { "CloseHSServiceRendircutisImmediatelyOnTimeout", "This option makes "
+ { "CloseHSServiceRendCircuitsImmediatelyOnTimeout", "This option makes "
"your hidden services easier to fingerprint." },
{ "WarnUnsafeSocks", "Changing this option makes it easier for you "
"to accidentally lose your anonymity by leaking DNS information" },
@@ -2049,6 +2049,7 @@ static const struct {
{ "-h", TAKES_NO_ARGUMENT },
{ "--help", TAKES_NO_ARGUMENT },
{ "--list-torrc-options", TAKES_NO_ARGUMENT },
+ { "--list-deprecated-options",TAKES_NO_ARGUMENT },
{ "--nt-service", TAKES_NO_ARGUMENT },
{ "-nt-service", TAKES_NO_ARGUMENT },
{ NULL, 0 },
@@ -2235,7 +2236,6 @@ static void
list_torrc_options(void)
{
int i;
- smartlist_t *lines = smartlist_new();
for (i = 0; option_vars_[i].name; ++i) {
const config_var_t *var = &option_vars_[i];
if (var->type == CONFIG_TYPE_OBSOLETE ||
@@ -2243,7 +2243,16 @@ list_torrc_options(void)
continue;
printf("%s\n", var->name);
}
- smartlist_free(lines);
+}
+
+/** Print all deprecated but non-obsolete torrc options. */
+static void
+list_deprecated_options(void)
+{
+ const config_deprecation_t *d;
+ for (d = option_deprecation_notes_; d->name; ++d) {
+ printf("%s\n", d->name);
+ }
}
/** Last value actually set by resolve_my_address. */
@@ -4703,10 +4712,15 @@ options_init_from_torrc(int argc, char **argv)
exit(0);
}
if (config_line_find(cmdline_only_options, "--list-torrc-options")) {
- /* For documenting validating whether we've documented everything. */
+ /* For validating whether we've documented everything. */
list_torrc_options();
exit(0);
}
+ if (config_line_find(cmdline_only_options, "--list-deprecated-options")) {
+ /* For validating whether what we have deprecated really exists. */
+ list_deprecated_options();
+ exit(0);
+ }
if (config_line_find(cmdline_only_options, "--version")) {
printf("Tor version %s.\n",get_version());
More information about the tor-commits
mailing list