public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Gregory M. Turner" <gmt@malth.us>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] relative ROOT: correct behavior when ROOT=
Date: Thu, 06 Sep 2012 00:44:59 -0700	[thread overview]
Message-ID: <5048547B.3040601@malth.us> (raw)

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#/}"

Thats a matter for another thread, however.

As I've been reading code like the above, I've stumbled across some bugs 
and inconsistencies pertaining to relative-ROOT and I've been trying to 
file bugs to get these fixed.

One such issue pertains to the case where the ROOT environment variable 
is defined, but empty.  Portage and most python code seem to treat this 
as equivalent to ROOT="${PWD}", which is to say, that relative-root 
functionality is triggered by this circumstance.

However, several app-admin and sys-devel scripts "disagree" and treat 
this as equivalent to ROOT="/" (as does my example above).

So... which behavior is correct?  Since I'm aware of the issue, I'd 
might as well file bugs against the incorrect ones and get everything 
consistent.

-gmt


             reply	other threads:[~2012-09-06  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06  7:44 Gregory M. Turner [this message]
2012-09-06  7:55 ` [gentoo-dev] relative ROOT: correct behavior when ROOT= Ulrich Mueller
2012-09-06  9:34   ` Gregory M. Turner
2012-09-06 12:56   ` Ian Stakenvicius
2012-09-07 20:50     ` [gentoo-dev] ROOT, EROOT, and EPREFIX in scripts (was: relative ROOT: correct behavior when ROOT=) Gregory M. Turner
2012-09-07 21:09       ` [gentoo-dev] ROOT, EROOT, and EPREFIX in scripts Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5048547B.3040601@malth.us \
    --to=gmt@malth.us \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox