Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 182346 - portage-2.1.3_rc3 removes files when moving from a directory to a symlink to that directory or vice versa
Summary: portage-2.1.3_rc3 removes files when moving from a directory to a symlink to ...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
Depends on:
Blocks: 193766 181949
  Show dependency tree
 
Reported: 2007-06-17 16:47 UTC by Marien Zwart (RETIRED)
Modified: 2007-09-25 18:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
use device/inode numbers are used to determine ownership (inodes.patch,1.73 KB, patch)
2007-06-17 22:18 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marien Zwart (RETIRED) gentoo-dev 2007-06-17 16:47:44 UTC
For testing the following works:

ln -s actual /tmp/sym

in testapp-1's src_install(): mkdir -p "${D}/tmp/sym"; touch "${D}/tmp/sym/file"

in testapp-2's src_install(): mkdir -p "${D}/tmp/actual"; touch "${D}/tmp/actual/file"

Now downgrading from testapp-2 to testapp-1 does:

>>> /tmp/sym/file
 * pkg_postinst testapp-1
>>> sys-apps/testapp-1 merged.

 sys-apps/testapp
    selected: 2 
   protected: 1 
     omitted: none

>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.

>>> Unmerging sys-apps/testapp-2...
 * pkg_prerm testapp-2
No package files given... Grabbing a set.
<<<        obj /tmp/actual/file
--- !owned dir /tmp
<<<        dir /tmp/actual

so it ends up removing the file it just installed, because it does not realise /tmp/actual/file and /tmp/sym/file are the same file (and apparently there is no mtime check). Upgrading from testapp-1 to testapp-2 has the same problem.

I'm marking this critical because you can hit this with python when upgrading from 2.4.3 to 2.4.4-r4 on amd64 with /usr/lib a symlink to /usr/lib64 or vice versa. Older pythons installed their pure-python files in /usr/lib64, newer pythons install them in /usr/lib. So when you upgrade between those versions using this version of portage, most of python gets wiped.
Comment 1 Zac Medico gentoo-dev 2007-06-17 22:18:30 UTC
Created attachment 122367 [details, diff]
use device/inode numbers are used to determine ownership

This should solve the problem.  It uses the same code that collision-protect uses to prevent false negatives when determining ownership.
Comment 2 Zac Medico gentoo-dev 2007-06-17 23:38:40 UTC
This has been released in 2.1.3_rc4.