Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 371735 - Weak ownership aka. package affinity for files
Summary: Weak ownership aka. package affinity for files
Status: CONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: PMS/EAPI
URL:
Whiteboard:
Keywords:
: 699798 (view as bug list)
Depends on:
Blocks: future-eapi 699588
  Show dependency tree
 
Reported: 2011-06-15 10:31 UTC by Martin von Gagern
Modified: 2020-12-26 23:33 UTC (History)
4 users (show)

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-06-15 10:31:43 UTC
There are basically three kinds of files in the non-home part of the file system:
1. Files installed by packages, and in the case of FEATURES=protect-owned
   associated with exactly one package that did install them.
2. Files (symlinks and *.pyc in particular) created by postinst hooks, eselect
   modules, library caching, or some other non-portage system tool operation.
   These are somewhat weakly related to a set of packages, but were not
   installed by any of them.
3. Files created by the user/admin or left over from some misbehaving tool.
   These are not related to any installed package at all.

It is currently almost impossible to distinguish cases 2. and 3. On the other hand, it might make sense to clean up those from 3. from time to time, in order to remove cruft and avoid possible causes for unexpected behaviour.

Therefore I suggest adding an option that would allow ebuilds to declare what I call a "file affinity": stating that a given file (or set of files identified using a glob, particularly useful for config dirs) are related to this package, although they haven't been installed by the package itself. A suitable command in ebuilds could be used to store this information in a temporary file to be later included in the CONTENTS of the package. Ebuild writers would be encouraged to declare affinity for all files that are commonly present on installs of their package.

This would allow tools like qfile from portage-utils to state all packages with an affinity to a named file, thus making the orphan search much more powerful.

You could also add an option to unmerging which would not only remove CONFIG_PROTECTed files but also clean all files with an affinity to a given package, as long as no other package has any kind of ownership (strong or weak) over them.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-09-06 21:53:47 UTC
Is there a real point for this? I guess at the time of reporting situation was worse but right now we try to make some packages own caches and other kinds of files that are updated in postinst. It's usually as trivial as installing an empty file -- it isn't perfect but it works.

I suspect having an explicit 'keepfile' (alike keepdir) wouldn't hurt but is it worth the effort?
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-12-16 13:01:03 UTC
*** Bug 699798 has been marked as a duplicate of this bug. ***