Opened 7 years ago

Closed 7 years ago

#9578 closed defect (fixed)

Tor obeys --quiet, --hush, etc without regard for argument order

Reported by: arma Owned by:
Priority: Medium Milestone: Tor: 0.2.5.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


When you run

$ src/or/tor contactinfo "--quiet"

it is not supposed to set your contactinfo to "--quiet" while at the same time telling Tor to change its default log setting.

The problem comes from

  /* We search for the "quiet" option first, since it decides whether we
   * will log anything at all to the command line. */
  for (i=1;i<argc;++i) {
    if (!strcmp(argv[i], "--hush"))
      quiet = 1;
    if (!strcmp(argv[i], "--quiet"))
      quiet = 2;
    /* --version implies --quiet */
    if (!strcmp(argv[i], "--version"))
      quiet = 2;

We just paw through the arg list without paying attention to syntax of other arguments.

Surely there's a better way. :)

Child Tickets

Change History (4)

comment:1 Changed 7 years ago by nickm

This is related to #4647 , I think

comment:2 Changed 7 years ago by arma


comment:3 Changed 7 years ago by nickm

Status: newneeds_review

See #4647 for this.

comment:4 Changed 7 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

#4647 fixed this. But there's a related issue where if you say --quiet --version and get a different outcome than if you had said --version --quiet.

Fixed that one with 6f9584b3fd5346bfc7ee58dedee2f1c292bf0354

Note: See TracTickets for help on using tickets.