Gentoo Archives: gentoo-dev

From: "Gregory M. Turner" <gmt@×××××.us>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: [RFC] Cleaning up PMS to have ${D} not end with a slash
Date: Mon, 15 Apr 2013 18:55:10
Message-Id: 516C4CDE.10205@malth.us
In Reply to: [gentoo-dev] Re: [RFC] Cleaning up PMS to have ${D} not end with a slash by "Steven J. Long"
1 On 4/15/2013 10:31 AM, Steven J. Long wrote:
2 > On Mon, Apr 15, 2013 at 12:01:24PM +0100, Ciaran McCreesh wrote:
3 >> On Mon, 15 Apr 2013 10:56:45 +0000
4 >> "Aaron W. Swenson" <titanofold@g.o> wrote:
5 >>> ROOT being a user set variable, having ROOT be an empty string by
6 >>> default still does not guarantee that ROOT won't end with a
7 >>> slash. Even if we change it so that it defaults to an empty string, it
8 >>> won't negate the need to do ${ROOT%/}/some/path.
9 >> The spec guarantees that ROOT will be non-empty and end in a slash. If
10 >> Portage isn't enforcing this, file a bug.
11 > Yes, but his point was this:
12 >
13 >>> The only thing that would help is if PMS defined that ROOT must not
14 >>> end with a slash.
15 >
16 > ie, let the mangler enforce empty or a valid directory not ending in a
17 > slash, which is hardly difficult, and makes ROOT easier to work with,
18 > along the lines of how any shellscripter would do it, similarly to the
19 > motivation for the change to D. Only with ROOT it's much more important
20 > that the path is correctly-formed for cross-platform compatibility.
21 That's how EPREFIX works; indeed, you don't need to do ${EPREFIX%/},
22 ever (unless, perhaps, we are manually scrubbing user inputs that
23 haven't been scrubbed by portage). Try it yourself: EPREFIX="/"
24 portageq envvar EPREFIX.
25
26 If we "wanted to" do the same thing to {E,}ROOT we could, at least in
27 future EAPIs.
28
29 However, given that ROOT is named "ROOT", "/" makes some kind of
30 reasonable, intuitive sense. I see double-slash mistakes involving ROOT
31 here and there, but they are not hopelessly ubiquitous as they are with
32 D, where, as Michał demonstrates in #465772, approximately 10 ebuilds in
33 portage use the variable incorrectly for every 1 getting it right!
34
35 -gmt

Replies

Subject Author
[gentoo-dev] Re: Re: [RFC] Cleaning up PMS to have ${D} not end with a slash "Steven J. Long" <slong@××××××××××××××××××.uk>