Fix spawning Tor subprocess when datadir contains spaces - #352
Open
MaximeMRF wants to merge 1 commit into
Open
Conversation
kwsantiago
suggested changes
Aug 4, 2026
There was a problem hiding this comment.
The Popen change is the right fix for #351. The other two parts should come out. Details inline.
MaximeMRF
force-pushed
the
fix/tor-datadir-spaces
branch
from
August 4, 2026 20:37
7fdd9ad to
df4fc30
Compare
kwsantiago
approved these changes
Aug 5, 2026
There was a problem hiding this comment.
tACK df4fc30
Verified on Linux with tor 0.4.8.10: datadir containing spaces launches Tor and advertises an onion, -torexecute="env tor" still works so the multi-word case is preserved, plain datadir unaffected, torcontrol_tests green. Generated torrc is back to unquoted values, so the Windows escape-sequence problem is gone.
Nit, not blocking: commit message is the branch name. Something like torcontrol: Pass Tor arguments as a vector to handle paths with spaces would read better in the log.
|
ACK df4fc30 A few nits:
Suggestions for follow-up:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bugfix, it resolve the issue #351
Motivation & Problem
Spawning the Tor subprocess fails when the data directory path contains spaces:
subprocess::Popenwas initialized with a concatenated command string, causing internalutil::split()to split paths containing spaces into invalid separate arguments.DataDirectoryandControlPortWriteToFilepaths without quotes, causing Tor's config parser to fail on paths with spaces.Solution
std::vector<std::string>tosubprocess::Popenso paths with spaces are passed monolithically to the OS process without string splitting.DataDirectoryandControlPortWriteToFilepaths in double quotes ingenerated_config.subprocess_vector_args_with_spacesunit test intorcontrol_tests.cpp.