Mailing List Archive

[PREFIX] config protect behavior in prefix
Hi,

I have a question on the config protect funcitonality in a prefixed
environment.

We typically set the CONFIG_PROTECT and CONFIG_PROTECT_MASK flags in the
profile make.defaults, etc/make.globals, etc/make.conf, or environment
variable.

If my prefix is '/opt/myprefix', I would expect to set my CONFIG_PROTECT
to something like:

CONFIG_PROTECT="/opt/myprefix/etc
/opt/myprefix/var/www/localhost/htdocs/mediawiki"

Basically, be explicit on the full path to be protected by portage.

But a closer look in the portage.py, it does some path manipulation
which, to me, seems to be a bug and out of place.

This line defined mergedir as a prefixed directory path
self.mergedir = os.path.normpath(myroot+os.path.sep+portage_const.EPREFIX)

Then in updateprotect(), we append the contents of CONFIG_PROTECT to the
prefixed mergedir.

def updateprotect(self):
#do some config file management prep
self.protect=[]
for x in string.split(self.settings["CONFIG_PROTECT"]):
ppath=normalize_path(self.mergedir+x)+"/"
if os.path.isdir(ppath):
self.protect.append(ppath)

self.protectmask=[]
for x in string.split(self.settings["CONFIG_PROTECT_MASK"]):
ppath=normalize_path(self.mergedir+x)+"/"
if os.path.isdir(ppath):
self.protectmask.append(ppath)
#if it doesn't exist, silently skip it

So, it ends up with my path looking like
'/opt/myprefix/opt/myprefix/etc', basically, double prefixed. I believe
the correct functionality would be to have the CONFIG_PROTECT
directories be explicit with prefix instead of implicitly prepending to
the list. The original portage only appends to 'myroot' and uses the
explicit paths in CONFIG_PROTECT.

Thought from others on what should be the behavior?
--
gentoo-osx@gentoo.org mailing list
[PREFIX] config protect behavior in prefix [ In reply to ]
Also, I discovered that 'etc-update' does not pre-pend EPREFIX when
resolving CONFIG_PROTECT directories.

In etc-update, in the scan() function, the following line should prepend
if portage does the same.

for path in ${CONFIG_PROTECT} ; do
## EPREFIX + path here
[ ! -d ${path} ] && continue
ofile=""
for file in `find ${path}/ -iname "._cfg????_*" |
sed -e
"s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\\2\%\3:" |
sort -t'%' -k3 -k2 | LANG=POSIX LC_ALL=POSIX
cut -f1\ -d'%'`; do

--
gentoo-osx@gentoo.org mailing list