Opened 9 years ago

Last modified 3 years ago

#5409 assigned defect

Warn if we're on Windows, and the user ends a line accepting a directory path with a backslash?

Reported by: Sebastian Owned by: Jigsaw52
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-client configuration directory windows
Cc: Jigsaw52 Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


We have a couple of bugs (one even in our documentation, ooops) where users put a \ at the end of a path on Windows, and our config parser takes this as being a line continuation (see #4798 and #4426 ). Maybe we can do better here, by warning the user that their backslash implies line continuation if they're on Windows and have that set for one of the config options that point to a directory?

Child Tickets

Change History (5)

comment:1 Changed 8 years ago by nickm

Keywords: tor-client added

comment:2 Changed 8 years ago by nickm

Component: Tor ClientTor

comment:3 Changed 6 years ago by netogallo

I gave a look to the code and noticed that first parsing is done line by line with "config_get_lines" which uses the function "parse_config_line_from_str_verbose". The function "parse_config_line_from_str_verbose" is responsible for handling the line continuations but knows nothing about what the setting is (it only splits into key and value). Much later the function "config_assign_value" from confparse.c figures out the type of each value.

Currently it is hard to display a warning since "config_assign_value" can't know if the line is a continuation (ie. ends with \) and "parse_config_line_from_str_verbose" can't know if the value is a filename. So possible fixes w/o a radical change in architechture are:

1) Add a flag to the "config_line_t" struct that indicates wether the line has a continuation and show the warning if the value is a file.
2) Store also store the raw value in the the "config_line_t" struct so we can do additional checks.
3) Re-structure the whole parsing ...

I am in favor of (2) but have never contributed any code to Tor.

comment:4 Changed 3 years ago by nickm

Cc: Jigsaw52 added
Keywords: configuration directory windows added
Severity: Normal

comment:5 Changed 3 years ago by Jigsaw52

Owner: set to Jigsaw52
Status: newassigned

I also agree with approach 2. I think it's better than storing just a continuation flag because, in the future, we may find that some other options benefit from having access to their raw configuration line.

I'll look into this.

Note: See TracTickets for help on using tickets.