Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 136199

Summary: Portage doesn't handle fifos correct
Product: Portage Development Reporter: Jonas Jonsson <jonas>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: High    
Version: 2.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 130612, 136244, 137445    
Attachments: An ebuild to show the problem
emerge --info

Description Jonas Jonsson 2006-06-09 08:11:17 UTC
Hi...

It looks like portage doesn't handle fifos correct, attach a .ebuild with a simple mkfifo creation.

First time I do an emerge test I get this:
>>> Merging net-print/test-1.0 to /
--- /var/
>>> /var/test/
>>> /var/test/testfifo

If I do an emerge test again right after I get this
>>> Merging net-print/test-1.0 to /
--- /var/
--- /var/test/
!!! /var/test/testfifo
>>> Safely unmerging already-installed instance...
<<<        fif /var/test/testfifo
<<<        dir /var/test
--- !empty dir /var
>>> Original instance of package unmerged safely.

The fifo /var/test/testfifo is removed and if I do it a third time it works again as in the first ouput.

There is an workaround for this to use an ugly hack in pkg_postinst and pkg_prerm but this way there will be files left when unmerge and isn't a good solution. Heard that there are some packages that use this kind of hack.
Comment 1 Jonas Jonsson 2006-06-09 08:12:17 UTC
Created attachment 88770 [details]
An ebuild to show the problem
Comment 2 Jonas Jonsson 2006-06-09 08:13:41 UTC
Created attachment 88771 [details]
emerge --info
Comment 3 Zac Medico gentoo-dev 2006-06-09 15:49:28 UTC
If the destination file doesn't exist, the fifo is correctly installed.  The merge logic doesn't even attempt to install the fifo if the destination file already exists.  Then, during the unmerge phase, the previously existing distination file is removed because it's timestamp has not changed since it was installed.
Comment 4 Zac Medico gentoo-dev 2006-06-09 22:12:33 UTC
Actually, the fifo mtime is not stored in CONTENTS, so we can't be sure if they belong to another package unless we search through all CONTENTS for all installed packages.  In svn r3482 I've changed it so that they will never be unmerged (we already do the same for device files).  In the future we should implement global reference counting so that we can simply unmerge files that are no longer owned by any installed packages.
Comment 5 Zac Medico gentoo-dev 2006-06-16 10:01:50 UTC
This has been released in 2.1.1_pre1.