Opened 2 years ago

Last modified 2 years ago

#28311 new enhancement

Call expand_filename (e.g. for ~ expansion) on all FILENAME config options

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Split off #28298:

Replying to arma:

Ok, that above fix is bad, because it will complain when you set DataDirectory to e.g. ~/.test -- which is actually an absolute path, even if it doesn't start with /.

"~" expansion is not universal: it only works in some shells, some languages, and some applications.

In particular, "~" expansion is not a documented feature of path_is_relative() or make_path_absolute(). We can add it as a feature if you want.

Child Tickets

Change History (5)

comment:1 Changed 2 years ago by arma

No, ~ is supposed to be supported. See expand_filename() -- it handles both ~/ and ~arma/.

So I think this ticket is already done.

comment:2 Changed 2 years ago by arma

For example, set a torrc file with

RunAsDaemon 1
DataDirectory ~/.test

and it should work as expected (even with the #28298 fix).

comment:3 Changed 2 years ago by teor

But PidFile ~/.torpid does not work, see #28311.

And path_is_relative() or make_path_absolute() don't handle "~".

At the very least, these functions should document their expectation that expand_filename() has been run on the path before they see it.

comment:4 Changed 2 years ago by arma

I think we need to:

(A) as you say, document in the two *path* functions that they expect expand_filename has already been called as needed.

(B) actually call expand_filename on all config options of type FILENAME, at the appropriate time (and figure out what that is)

(C) change some things from STRING to FILENAME so they will benefit from step b. PidFile is one such thing.

comment:5 Changed 2 years ago by arma

Parent ID: #28298
Summary: Do ~ expansion on tor's configured pathsCall expand_filename (e.g. for ~ expansion) on all FILENAME config options

(removing #28298 as a parent, since this ticket is about a further improvement, and that ticket is about a regression)

Note: See TracTickets for help on using tickets.