Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#1522 closed defect (fixed)

Tor aborts when a 'getinfo config-text' command is sent to the controller and $HOME is unsent.

Reported by: katmagic Owned by:
Priority: Low Milestone:
Component: Core Tor/Tor Version: Tor: 0.2.2.x-final
Severity: Keywords: controller
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


When the HOME environment variable is unset in the Tor process and an authenticated control session sends "GETINFO config-text\n", Tor aborts logging;

[warn] Couldn't find $HOME environment variable while expanding "~/.tor"
[warn] Failed to expand filename "~/.tor".
[err] config_dump(): Bug: Failed to validate default config.
[err] config_dump(): Bug: config.c:2573: config_dump: Assertion 0 failed; aborting.

Child Tickets

Change History (8)

comment:1 Changed 10 years ago by nickm

Interesting! What do you suppose is a reasonable default for the datadir if HOME isn't set? I guess we could just set it to /var/lib/tor in that case and be done with it.

comment:2 Changed 10 years ago by Sebastian

We're using 'LOCALSTATEDIR PATH_SEPARATOR tor' during startup. I'm looking at making a patch.

comment:3 Changed 10 years ago by Sebastian

Another problem I noticed here is that if LOCALSTATEDIR doesn't exist, we can't even start. Do people think it is worthwhile to recursively create the directory if we can? Steps to reproduce: unset $HOME, then launch a tor that has a custom prefix.

comment:4 Changed 10 years ago by Sebastian

What I'm a bit confused about is how Tor managed to start at all with $HOME unset; or did you unset it while tor was running?

In any case, I have a trivial proposed patch that treats an unset $HOME like an empty $HOME. See branch bug1522 in my repo.

comment:5 Changed 10 years ago by nickm

Resolution: fixed
Status: newclosed

merging, with 1 change: I think we should indeed warn about the $HOME-not-set case, since it is almost definitely not what the user wanted.

comment:6 Changed 10 years ago by Sebastian

Ah, I took it out because we still log this warning:

[warn] Default DataDirectory is "~/.tor". This expands to "/.tor", which is probably not what you want. Using "/usr/lib/var/tor" instead

But I guess telling the user that there is no $HOME might be useful; still. Maybe we should also warn if $HOME is empty?

comment:7 Changed 10 years ago by nickm

Well, we do now warn if $HOME is empty and we try to get $HOME. Improving the warnings more would be fine IMO though, though I bet that this isn't a common enough thing for users to do to be worth a lot more effort.

comment:8 Changed 8 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.