torproject / stem

Python controller library for Tor
https://stem.torproject.org/
GNU Lesser General Public License v3.0
257 stars 75 forks source link

get_system_tor_version not working properly on Windows #124

Closed EchterAgo closed 1 year ago

EchterAgo commented 1 year ago

This is not actually an issue in stem, but I post this here so it is written down somewhere.

The get_system_tor_version function calls tor --version using subprocess.Popen to determine the version number. On Windows this fails because the output is empty. Turns out this also happens when you just pipe the output in a shell:

C:\dev>tor.exe --version | more

C:\dev>tor.exe --version
Tor version 0.4.7.7 (git-1bd324e1c0ac7f7b).
Tor is running on Windows 8 [or later] with Libevent 2.1.11-stable, OpenSSL 1.1.1o, Zlib 1.2.11, Liblzma N/A, Libzstd N/A and Unknown N/A as libc.
Tor compiled with GCC version 10.0.0

C:\dev>tor.exe | more
Aug 08 21:58:09.174 [notice] Tor 0.4.7.7 (git-1bd324e1c0ac7f7b) running on Windows 8 [or later] with Libevent 2.1.11-stable, OpenSSL 1.1.1o, Zlib 1.2.11, Liblzma N/A, Libzstd N/A and Unknown N/A as libc.
Aug 08 21:58:09.174 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Aug 08 21:58:09.174 [notice] Configuration file "(null)" not present, using reasonable defaults.

This seems like an issue in Tor. In the current stem release this will cause launch_tor_with_config to always use the use_stdin==False code path.

EchterAgo commented 1 year ago

After reinstalling Windows this now works. I suspect this is called by some other software that I had installed. I will try to find out what is causing it.