Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 664940 - sys-apps/portage: File-directory replacement behavior leaves cruft on the filesystem
Summary: sys-apps/portage: File-directory replacement behavior leaves cruft on the fil...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-31 07:29 UTC by Michał Górny
Modified: 2022-04-12 14:25 UTC (History)
3 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 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-08-31 07:29:26 UTC
* 
 * Installation of a directory is blocked by a file:
 *   '/usr/lib64/gimp/2.0/plug-ins/web-browser'
 * This file will be renamed to a different name:
 *   '/usr/lib64/gimp/2.0/plug-ins/web-browser.backup.0000'
 * 

Portage does not take care of managing/recording the 'backup' appropriately, and therefore anytime this occurs, users are left with a lot of cruft that won't be cleaned up automatically and that requires full manual intervention.  Furthermore, given that PMS specifically forbids doing this, developers aren't warned of the problem in time and ebuilds with such breakage are deployed to a lot of our user systems.

My suggestion would be to detect this kind of file collisions early, and fail hard when they happen.
Comment 1 Zac Medico gentoo-dev 2018-09-01 04:27:34 UTC
(In reply to Michał Górny from comment #0)
> My suggestion would be to detect this kind of file collisions early, and
> fail hard when they happen.

I suppose the natural way to resolve it would be a hard blocker? This could lead to difficult situations if critical system packages are involved, since it might not be practical to uninstall them in advance.

An alternative might be to have some kind of central registry for things that have to be moved for some reason, kind of like portage's preserve-libs registry.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-09-01 05:36:55 UTC
A hard blocker or pkg_preinst() magic, I suppose.
Comment 3 Zac Medico gentoo-dev 2018-09-01 09:21:15 UTC
Maybe something like this for pkg_preinst() magic:

src_install() {
	emake DESTDIR="${D}" install

	# Rename directory in ED, in order to bypass collision
	# protection and handle it manually.
	mv "${ED}/foo/bar"{,.new} || die
}

pkg_preinst() {
	# Remove file in EROOT that the directory collides with.
	rm -f "${EROOT}/foo/bar" || die

	# Following the collision protection check, reverse
	# src_install's rename in ED.
	mv "${ED}/foo/bar"{.new,} || die
}