Gentoo Archives: gentoo-dev

From: Ian Stakenvicius <axs@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] relative ROOT: correct behavior when ROOT=
Date: Thu, 06 Sep 2012 12:57:39
Message-Id: 50489D6F.7070907@gentoo.org
In Reply to: Re: [gentoo-dev] relative ROOT: correct behavior when ROOT= by Ulrich Mueller
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA256
3
4 On 06/09/12 03:55 AM, Ulrich Mueller wrote:
5 >>>>>> On Thu, 06 Sep 2012, Gregory M Turner wrote:
6 >
7 >> Hello, in my overlay I need to fix a bunch of issues that crop up
8 >> when implementing EPREFIX construction in scripts due to Cygwin's
9 >> idiosyncratic, but POSIX-compliant, handling of paths beginning
10 >> with "//" (Cygwin does some arguably pathological stuff when such
11 >> paths are used).
12 >
13 >> Almost all of these stem from the careless tacking of "ROOT" onto
14 >> "EPREFIX" in bash-scripts, i.e., as in this (made-up)
15 >> bash-script snippet:
16 >
17 >> ${ROOT:=/} EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
18 >> EROOT="${ROOT}${EPREFIX}"
19 >
20 >> When ROOT is undefined or empty, this script will assign "//foo"
21 >> to EROOT and bad things will happen in Cygwin.
22 >
23 >> Several correct-ish solutions exist, i.e., in the above we could
24 >> change the concatenation statement to read:
25 >
26 >> EROOT="${ROOT}${EPREFIX#/}"
27 >
28 > I'd rather do it the other way around: EROOT=${ROOT%/}${EPREFIX}
29 >
30 > Reason: EPREFIX is guaranteed to start with a slash, whereas for
31 > ROOT I wouldn't be so sure that it always ends with one.
32 >
33 > Ulrich
34 >
35
36 Not to mention that `man 5 ebuild` specifically defines EROOT to be
37 "${ROOT%/}${EPREFIX}/" already , so all that's needed is the removal
38 of the final '/' if I'm reading this correctly..
39
40
41
42
43
44 -----BEGIN PGP SIGNATURE-----
45 Version: GnuPG v2.0.19 (GNU/Linux)
46
47 iF4EAREIAAYFAlBInW8ACgkQ2ugaI38ACPA0UQD/YePPvXa5wNhdvpk656RtwNwa
48 +yUJKdh/cdu2d8lKCcQA/2/SI4ApNEY/uAf0VxEyRKE6jxdm9/KM6a9gWfSJ0ttn
49 =gJ7i
50 -----END PGP SIGNATURE-----

Replies