When using INSTALL_MASK to filter out files when installing (from .tbz2 binary packages) filter applies to folders or regular files but symlinks still get installed. Reproducible: Always Steps to Reproduce: echo << EOF > /etc/portage/package.env app-arch/gzip INSTALL_MASK.conf app-arch/gzip.conf EOF echo << EOF > /etc/portage/env/INSTALL_MASK.conf INSTALL_MASK="*.a *.o *.la /usr/lib/debug/ /usr/include/ /usr/share/doc/ /usr/share/gtk-doc/ /usr/share/info/ /usr/share/aclocal/ /usr/share/man/man3/ /usr/lib/pkgconfig/ /etc/conf.d/ /etc/init.d/ /run/ /var/run/" EOF echo << EOF > /etc/portage/env/app-arch/gzip.conf INSTALL_MASK="${INSTALL_MASK} /bin/gunzip /bin/uncompress /bin/zcat /usr/bin /usr/share/man/man1/gunzip.1* /usr/share/man/man1/uncompress.1* /usr/share/man/man1/zcat.1* /usr/share/man/man1/gzexe.1* /usr/share/man/man1/zcmp.1* /usr/share/man/man1/zdiff.1* /usr/share/man/man1/zforce.1* /usr/share/man/man1/zgrep.1* /usr/share/man/man1/zless.1* /usr/share/man/man1/zmore.1* /usr/share/man/man1/znew.1*" EOF emerge --oneshot --usepkg app-arch/gzip Actual Results: These are the packages that would be merged, in order: Calculating dependencies... done! [binary R ] app-arch/gzip-1.6::gentoo to /mnt/soekris/ USE="-pic -static" 0 KiB Total: 1 package (1 reinstall, 1 binary), Size of downloads: 0 KiB Would you like to merge these packages? [Yes/No] >>> Emerging binary (1 of 1) app-arch/gzip-1.6::gentoo for / * gzip-1.6.tbz2 MD5 SHA1 size ;-) ... [ ok ] >>> Extracting info >>> Extracting app-arch/gzip-1.6 >>> Installing (1 of 1) app-arch/gzip-1.6::gentoo to / * Removing /usr/lib/debug/ * Removing /usr/share/doc/ * Removing /usr/share/info/ * Removing /bin/gunzip * Removing /bin/zcat * Removing /usr/bin * Removing /usr/share/man/man1/gunzip.1* * Removing /usr/share/man/man1/zcat.1* * Removing /usr/share/man/man1/gzexe.1* * Removing /usr/share/man/man1/zcmp.1* * Removing /usr/share/man/man1/zdiff.1* * Removing /usr/share/man/man1/zforce.1* * Removing /usr/share/man/man1/zgrep.1* * Removing /usr/share/man/man1/zless.1* * Removing /usr/share/man/man1/zmore.1* * Removing /usr/share/man/man1/znew.1* * checking 3 files for package collisions >>> Merging app-arch/gzip-1.6 to /mnt/soekris/ --- /bin/ >>> /bin/gzip --- /usr/ --- /usr/lib/ --- /usr/share/ --- /usr/share/man/ --- /usr/share/man/man1/ >>> /usr/share/man/man1/gzip.1.bz2 * QA Notice: Symbolic link /bin/uncompress points to /bin/gunzip which does not exist. >>> /bin/uncompress -> gunzip >>> Safely unmerging already-installed instance... No package files given... Grabbing a set. --- replaced obj /usr/share/man/man1/gzip.1.bz2 --- replaced dir /usr/share/man/man1 --- replaced dir /usr/share/man --- replaced dir /usr/share --- replaced dir /usr/lib --- replaced dir /usr --- replaced sym /bin/uncompress --- replaced obj /bin/gzip --- replaced dir /bin >>> Regenerating /etc/ld.so.cache... >>> Original instance of package unmerged safely. >>> app-arch/gzip-1.6 merged. >>> Auto-cleaning packages... Expected Results: The /bin/uncompress symlink should not get installed as it's listed in INSTALL_MASK as is symlink's target. Note: in the past this worked correctly though I can't tell when it stopped working.
A probably important detail: If symlink target is masked by INSTALL_MASK the symlink is still installed even though listed in INSTALL_MASK. If symlink target is not masked (that it, it's being effectively installed), the symlink when masked by INSTALL_MASK does not get installed as expected. So for above example case, if /bin/gunzip was no covered by INSTALL_MASK, /bin/uncompress symlink would not get installed as requested by INSTALL_MASK.
It's a regression from this commit: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5a1b870fe54ac06f864a648c3ea5cc118f6ce911
This is fixed in the master branch: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f9d1791dbb8f61e836d1b453258502d800776bf2
Fixed in 2.2.27.