Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 169132 - Wildcards in INSTALL_MASK match only files installed on real filesystem
Summary: Wildcards in INSTALL_MASK match only files installed on real filesystem
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-03 14:55 UTC by Georgi Georgiev
Modified: 2022-10-20 02:43 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georgi Georgiev 2007-03-03 14:55:51 UTC
I just found out the hard way that having absolute paths in "INSTALL_MASK" does not do exactly what I thought it would. The difference is felt when you have wildcards. For example, I have the following INSTALL_MASK to preventively purge any locales that I am not interested in:
/usr/share/locale/[^bej]*/ /usr/share/locale/b[^g]*/...
etc.

However, these wildcards get matched against the live filesystem. So, if a package  installs a locale that I don't yet have on the real filesystem, the wildcard won't match and the locale will get though.

Here is a "steps to reproduce" (picking a random small package):

1. emerge -C eselect-vi (make sure you don't have this one)
2. env INSTALL_MASK='/usr/share/eselect/modules/*.eselect' emerge eselect-vi

Expected results:
/usr/share/eselect/modules/vi.eselect not getting merged

Actual results:
/usr/share/eselect/modules/vi.eselect is merged

I could agree that this is desired behavior, but please at least add a mention in the manpage. Everywhere I've looked I've seen absolute paths given as examples ("/usr/share/info" being a common one) and that has lead me (and maybe others) off-track.

I can confirm that removing the leading slashes from all entries in INSTALL_MASK had the desired effect.

I would personally favor a warning (is that an overkill?) when an absolute path is encountered in INSTALL_MASK.
Comment 1 Georgi Georgiev 2007-03-03 14:59:12 UTC
Additional note.

I wanted to strip the leading slashes automatically, but it is not trivial to do in bash considering that what we are starting with is not an array. I was looking at bin/misc-functions.sh and the call to install_mask() from preinst_mask() is where the wildcards are expanded. Not an easy task, but I guess a warning would be good...
Comment 2 Marius Mauch (RETIRED) gentoo-dev 2007-05-31 00:57:19 UTC
Hmm, when I read the code correctly then absolute paths should just work as intended (matched against $IMAGE).
Comment 3 Georgi Georgiev 2007-05-31 01:14:31 UTC
(In reply to comment #2)
> Hmm, when I read the code correctly then absolute paths should just work as
> intended (matched against $IMAGE).

Not if you have wildcards. The wildcards are expanded when the mask is passed to install-mask() and if the path is absolute they get matched against the live system. For example:

# env INSTALL_MASK='/usr/share/eselect/modules/*.eselect' emerge eselect-vi
... snip ...
>>> Done.
* checking 1 files for package collisions
>>> Merging app-admin/eselect-vi-1.1.4 to /
 * Removing /usr/share/eselect/modules/bashcomp.eselect
 * Removing /usr/share/eselect/modules/binutils.eselect
 * Removing /usr/share/eselect/modules/env.eselect
 * Removing /usr/share/eselect/modules/java-nsplugin.eselect
 * Removing /usr/share/eselect/modules/java-vm.eselect
 * Removing /usr/share/eselect/modules/kernel.eselect
 * Removing /usr/share/eselect/modules/mailer.eselect
 * Removing /usr/share/eselect/modules/news.eselect
 * Removing /usr/share/eselect/modules/opengl.eselect
 * Removing /usr/share/eselect/modules/profile.eselect
 * Removing /usr/share/eselect/modules/rc.eselect
 * Removing /usr/share/eselect/modules/repo.eselect
 * Removing /usr/share/info
--- /usr/
--- /usr/share/
--- /usr/share/eselect/
--- /usr/share/eselect/modules/
>>> /usr/share/eselect/modules/vi.eselect
>>> app-admin/eselect-vi-1.1.4 merged.
Comment 4 Marius Mauch (RETIRED) gentoo-dev 2007-05-31 01:21:47 UTC
Hmm, so we'd have to disable globbing also before calling install_mask(). Mike, Ned, what do you think about that?
Comment 5 SpanKY gentoo-dev 2007-05-31 02:02:31 UTC
for sanity sake, we can just prefix each argument with ./ while processing ...
Comment 6 Marius Mauch (RETIRED) gentoo-dev 2007-06-05 18:05:59 UTC
(In reply to comment #5)
> for sanity sake, we can just prefix each argument with ./ while processing ...

Your choice.