On 4/15/2013 10:31 AM, Steven J. Long wrote:
On Mon, Apr 15, 2013 at 12:01:24PM +0100, Ciaran McCreesh wrote:
On Mon, 15 Apr 2013 10:56:45 +0000
"Aaron W. Swenson" <[email protected]> wrote:
ROOT being a user set variable, having ROOT be an empty string by
default still does not guarantee that ROOT won't end with a
slash. Even if we change it so that it defaults to an empty string, it
won't negate the need to do ${ROOT%/}/some/path.
The spec guarantees that ROOT will be non-empty and end in a slash. If
Portage isn't enforcing this, file a bug.
Yes, but his point was this:
The only thing that would help is if PMS defined that ROOT must not
end with a slash.
ie, let the mangler enforce empty or a valid directory not ending in a
slash, which is hardly difficult, and makes ROOT easier to work with,
along the lines of how any shellscripter would do it, similarly to the
motivation for the change to D. Only with ROOT it's much more important
that the path is correctly-formed for cross-platform compatibility.
That's how EPREFIX works; indeed, you don't need to do ${EPREFIX%/},
ever (unless, perhaps, we are manually scrubbing user inputs that
haven't been scrubbed by portage). Try it yourself: EPREFIX="/"
portageq envvar EPREFIX.
If we "wanted to" do the same thing to {E,}ROOT we could, at least in
future EAPIs.
However, given that ROOT is named "ROOT", "/" makes some kind of
reasonable, intuitive sense. I see double-slash mistakes involving ROOT
here and there, but they are not hopelessly ubiquitous as they are with
D, where, as Michał demonstrates in #465772, approximately 10 ebuilds in
portage use the variable incorrectly for every 1 getting it right!
-gmt