torrc parsing b0rks on carriage-return
- Truncate descriptions
Windows still terminates text files with '\r\n' by default, this seems to break the handling of quoted values in torrc.
https://gitweb.torproject.org/tor.git/tree/src/common/util.c#n2899
It consumes the quoted string, then consumes any trailing whitespace (tabs or spaces), then it expects either a comment '#' or an '\n'. However if a file edited through notepad.exe for example, the first character it encounters would be '\r', preceding the '\n'.
This results in tor throwing: "[warn] Error while parsing configuration: Excess data after quoted string" then erroring out.
Testing on 0.2.7.6.
Steps to reproduce:
$ printf "SocksPort 54321\nDataDirectory \"/tmp/datadir\"\r\n" > /tmp/conf
$ tor -f /tmp/conf
...[notice] Tor v0.2.7.6 (git-605ae665009853bd) running on Linux with Libevent 2.0.21-stable, OpenSSL 1.0.2h and Zlib 1.2.8
...[notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
...[notice] Read configuration file "/tmp/conf".
...[warn] Error while parsing configuration: Excess data after quoted string
...[err] Reading config failed--see warnings above.
$
- Show labels
- Show closed items