Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 384397 - False alarms for protected_symlinks
Summary: False alarms for protected_symlinks
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 402213 405175
  Show dependency tree
 
Reported: 2011-09-25 03:10 UTC by Martin von Gagern
Modified: 2013-01-24 14:24 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 Martin von Gagern 2011-09-25 03:10:24 UTC
OK, so now portage will make an attempt to keep symlinks, apparently related to bug #326685 comment #18. Quoting the message text, so users will find this bug:

ERROR: postrm
One or more symlinks to directories have been preserved in order to
ensure that files installed via these symlinks remain accessible:

	/some/path/to/a/symlink_to_dir

I got a number of elog mails due to this, and all of them bogus so far:
1. Unmerged all of KDE3 from kde-sunset. Most packages had a symlink called
   /usr/kde/3.5/share/doc/HTML/en/${PN}/common pointing to some common KDE docs.
2. Unmerged kde-base/okteta which had a symlink called
   /usr/share/doc/HTML/en/okteta/common looking very much like the KDE3 setup.
   'ls -1d /usr/share/doc/HTML/en/*/common | wc -l' counts 116 such links.
3. /usr/share/doc/boost-1.46.1/html/boost when upgrading dev-libs/boost using
   portage-2.2.0_alpha51. Not sure whether that was before or after 40f45506b5.

I'm not exactly sure how to improove this, but I believe that the current code leads to way too many false alarms. Perhaps the best thing to do would be checking whether any other package was installed using that symlink, and if not, remove the link anyway. I know this might be a costly operation, but it should be rather rare, right? Perhaps the result should be cached somehow, as e.g. large KDE unmerges would check for the same target dir over and over again.

Another way would be for an ebuild to actually declare a symlink as being "foreign", i.e. pointing to code outside its sphere of control. Which might again lead to packages installed using those symlinks if used incorrectly.
Comment 1 Zac Medico gentoo-dev 2011-09-25 03:28:34 UTC
(In reply to comment #0)
> Perhaps the best thing to do would be
> checking whether any other package was installed using that symlink, and if
> not, remove the link anyway. I know this might be a costly operation, but it
> should be rather rare, right?

Yes, we can do that. Even without a cache, it should be rare enough that the performance penalty is not a major obstacle.

> Perhaps the result should be cached somehow, as
> e.g. large KDE unmerges would check for the same target dir over and over
> again.

We have an owners cache that hashes files by basename, but it performs very poorly for basenames that are not very unique. The reason that it uses the basename is that the basename serves as a reliable hash even in cases where the parent directories happen to be symlinks. For example, if a file with basename 'x' is installed as /usr/lib/x and /usr/lib is a symlink to /usr/lib64, the hash of the basename 'x' is constant regardless of whether CONTENTS entry refers to it via /usr/lib or /usr/lib64.
Comment 2 Martin von Gagern 2011-10-26 21:04:05 UTC
Hit this again today, including boost. Any progress yet?
Comment 3 Tomáš Chvátal (RETIRED) gentoo-dev 2011-10-31 13:28:49 UTC
Same issue is in libreoffice.
It would be cool to see this fixed :)
Comment 5 Zac Medico gentoo-dev 2012-02-23 06:12:56 UTC
This is fixed in 2.1.10.49 and 2.2.0_alpha89.
Comment 6 Petre Rodan 2013-01-24 09:14:51 UTC
is there any switch to disable the 'happy removing things that might not be used by something else' behavior? or even better a non-default switch to enable that?

because:

 1. not all software present on a gentoo box is guaranteed to reside in portage or even in an overlay. think closed source third-party non-publicly available montly-changing software. (yes that's a real scenario). making an ebuild for something like this is a waste of time. I place that into /local with a symlink from /opt. /opt will be removed by portage. that software will start breaking with nasty implications.

 2. gentoo is by definition infinitely-customizable. I have one /tmp mounted as tmpfs and /var a smallish partion with /var/tmp a symlink to /tmp. 
that /var/tmp symlink will be removed by portage since it is falsely believed not to be in use. software using /var/tmp will of course go dead.

these two scenarios are just what I found in an hour, there might be other non-obvious ones.

there is nothing worse than software that tries to be too smart for it's own good.
Comment 7 Martin von Gagern 2013-01-24 09:43:39 UTC
This bug here was about packages not removing symlinks they created themselves. The fix was to enable said removal if no one else was using those symlinks. If you have any issues about packages or portage in general removing symlinks which you as an admin added manually, then this seems like a different issue that would be better tracked in a separate report.
Comment 8 Petre Rodan 2013-01-24 10:08:39 UTC
the code commited to fix your original bug has the unfortunate side-effect of removing symlinks I'm attached to. unfortunately I can't reopen the bug :/
Comment 9 Zac Medico gentoo-dev 2013-01-24 14:24:52 UTC
(In reply to comment #6)
> is there any switch to disable the 'happy removing things that might not be
> used by something else' behavior? or even better a non-default switch to
> enable that?

You can use a setting in make.conf like this:

UNINSTALL_IGNORE="${UNINSTALL_IGNORE} /path/of/protected/symlink"