TorCtl Misparsing Escaped Cookie Paths
The proper handling for the cookie file paths are actually kinda complicated since it can contain escape characters ("Controllers MUST handle escape sequences inside this string." [1]). Functionally this means that its been processed by tor's "esc_for_log" function in 'common/util.c'.
TorCtl not only doesn't unescape paths, but also chokes if there's an escaped quote within it. For instance...
atagar@morrigan:~/Desktop/arm/src$ cat ~/.tor/torrc
SocksPort 0
ControlPort 9051
CookieAuthentication 1
DataDirectory /tmp/my data"dir/
atagar@morrigan:~/Desktop/arm/src$ python
>>> from TorCtl import TorCtl
>>> conn = TorCtl.connect()
INFO[Sat Oct 29 10:46:55 2011]:Event loop received close message.
INFO[Sat Oct 29 10:46:55 2011]:Event loop received close message.
NOTICE[Sat Oct 29 10:46:55 2011]:Tor closed control connection. Exiting event thread.
NOTICE[Sat Oct 29 10:46:55 2011]:Tor closed control connection. Exiting event thread.
Failed to read authentication cookie (file doesn't exist): /tmp/my data\
For stem's handling of this see the 'CONTROL_ESCAPES' uses in: https://gitweb.torproject.org/stem.git/blob/HEAD:/stem/types.py#l39
Cheers! -Damian
[1] https://gitweb.torproject.org/torspec.git/blob/HEAD:/control-spec.txt#l960