>>>>> On Thu, 06 Sep 2012, Gregory M Turner wrote: > Hello, in my overlay I need to fix a bunch of issues that crop up when > implementing EPREFIX construction in scripts due to Cygwin's > idiosyncratic, but POSIX-compliant, handling of paths beginning with > "//" (Cygwin does some arguably pathological stuff when such paths are > used).
> Almost all of these stem from the careless tacking of "ROOT" onto > "EPREFIX" in bash-scripts, i.e., as in this (made-up) bash-script snippet: > ${ROOT:=/} > EPREFIX="@GENTOO_PORTAGE_EPREFIX@" > EROOT="${ROOT}${EPREFIX}" > When ROOT is undefined or empty, this script will assign "//foo" to > EROOT and bad things will happen in Cygwin. > Several correct-ish solutions exist, i.e., in the above we could change > the concatenation statement to read: > EROOT="${ROOT}${EPREFIX#/}" I'd rather do it the other way around: EROOT=${ROOT%/}${EPREFIX} Reason: EPREFIX is guaranteed to start with a slash, whereas for ROOT I wouldn't be so sure that it always ends with one. Ulrich