Bug 1477196

Summary: rpm removes files from newly installed/updated packages
Product: Red Hat Enterprise Linux 6 Reporter: Petr Stodulka <pstodulk>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.9CC: ffesti, ksrot, pmatilai
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1477214 (view as bug list) Environment:
Last Closed: 2017-10-10 14:10:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1477214, 1499211    
Attachments:
Description Flags
dummy-1.0-1.fc26.noarch.rpm
none
dummy-1.0-2.fc26.noarch.rpm
none
log none

Description Petr Stodulka 2017-08-01 12:53:01 UTC
Description of problem:
During transaction can be removed files from new packages, when new package contains symlink to directory, which contains files that corespond to files inside packages removed during transaction. Example:

old rpm:
/usr/share/dummy
/usr/share/dummy/subdir
/usr/share/dummy/subdir/dummy_file

new rpm:
/usr/share/dummy
/usr/share/dummy/dummy_file
/usr/share/dummy/subdir

Where the last one is symlink:
/usr/share/dummy/subdir -> .

In that case the /usr/share/dummy/dummy_file file will be removed during removing of the old_rpm.

How reproducible:
always

Steps to Reproduce:
1. # yum -y install the dummy-1.0-1.fc26.noarch.rpm rpm 
2  # rpm --upgrade dummy-1.0-2.fc26.noarch.rpm
3. # rpm -V dummy

- attached dummy rpms


Actual results:
1. # yum -y install the dummy-1.0-1.fc26.noarch.rpm rpm 
2  # rpm --upgrade dummy-1.0-2.fc26.noarch.rpm
3. # rpm -V dummy
missing     /usr/share/dummy/dummy_file


Expected results:
1. # yum -y install the dummy-1.0-1.fc26.noarch.rpm rpm 
2  # rpm --upgrade dummy-1.0-2.fc26.noarch.rpm
3. # rpm -V dummy

(all files are installed correctly)

Additional info:
The new_rpm rpm contains %pre section, which removes the
/usr/share/dummy/subdir directory in case that exists, so symlink can be
created correctly.

Comment 1 Petr Stodulka 2017-08-01 12:54:31 UTC
Created attachment 1307554 [details]
dummy-1.0-1.fc26.noarch.rpm

Comment 2 Petr Stodulka 2017-08-01 12:55:04 UTC
Created attachment 1307555 [details]
dummy-1.0-2.fc26.noarch.rpm

Comment 3 Petr Stodulka 2017-08-01 12:56:03 UTC
Created attachment 1307556 [details]
log

debug log from upgrade transaction.

Comment 4 Panu Matilainen 2017-08-22 14:06:32 UTC
> Additional info:
> The new_rpm rpm contains %pre section, which removes the
> /usr/share/dummy/subdir directory in case that exists, so symlink can be
> created correctly.

You need to you %pretrans for such a thing. %pre happens long long after rpm has calculated what it needs to do in the transaction and cannot change its mind if scripts (re)move things behind its back.

Comment 5 Panu Matilainen 2017-08-23 11:02:48 UTC
This differs from bug 1477214 in that rpm in rhel-6 doesn't yet detect the directory <-> symlink conflicts so you don't get an early warning, but the need to use %pretrans instead of %pre is just the same regardless.

I dont think we want to try backporting the conflict stuff to rhel-6 at this point of its life cycle, but leaving this open for a bit just in case.

Comment 6 Red Hat Bugzilla Rules Engine 2017-10-10 14:10:08 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.