Bug 1477215 - rpm removes files from newly installed/updated packages
Summary: rpm removes files from newly installed/updated packages
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-01 13:34 UTC by Petr Stodulka
Modified: 2017-08-23 10:50 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1477214
Environment:
Last Closed: 2017-08-23 10:50:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
log (6.53 KB, text/plain)
2017-08-01 13:35 UTC, Petr Stodulka
no flags Details
dummy-1.0-1.fc26.noarch.rpm (6.56 KB, application/x-rpm)
2017-08-01 13:35 UTC, Petr Stodulka
no flags Details
dummy-1.0-2.fc26.noarch.rpm (6.74 KB, application/x-rpm)
2017-08-01 13:36 UTC, Petr Stodulka
no flags Details
dummy-1.0-1.fc26.src.rpm (6.80 KB, application/x-rpm)
2017-08-03 08:26 UTC, Petr Stodulka
no flags Details
dummy-1.0-2.fc26.src.rpm (6.88 KB, application/x-rpm)
2017-08-03 08:27 UTC, Petr Stodulka
no flags Details

Description Petr Stodulka 2017-08-01 13:34:03 UTC
+++ This bug was initially created as a clone of Bug #1477214 +++

+++ This bug was initially created as a clone of Bug #1477196 +++

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 --replacefiles 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 --replacefiles  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 --replacefiles  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.

--- Additional comment from  on 2017-08-01 14:54 CEST ---



--- Additional comment from  on 2017-08-01 14:55 CEST ---



--- Additional comment from  on 2017-08-01 14:56 CEST ---

debug log from upgrade transaction.

Comment 1 Petr Stodulka 2017-08-01 13:35:04 UTC
Created attachment 1307586 [details]
log

debug log from upgrade transaction

Comment 2 Petr Stodulka 2017-08-01 13:35:48 UTC
Created attachment 1307589 [details]
dummy-1.0-1.fc26.noarch.rpm

Comment 3 Petr Stodulka 2017-08-01 13:36:10 UTC
Created attachment 1307592 [details]
dummy-1.0-2.fc26.noarch.rpm

Comment 4 Igor Gnatenko 2017-08-01 17:53:23 UTC
Could you provide SRPMs as well please?

Comment 5 Petr Stodulka 2017-08-03 08:26:49 UTC
Created attachment 1308625 [details]
dummy-1.0-1.fc26.src.rpm

Here it is.

Comment 6 Petr Stodulka 2017-08-03 08:27:23 UTC
Created attachment 1308626 [details]
dummy-1.0-2.fc26.src.rpm

Comment 7 Panu Matilainen 2017-08-23 10:50:35 UTC
So here's what I actually see:

[root@sopuli Downloads]# rpm -Uvh dummy-1.0-1.fc26.noarch.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:dummy-1.0-1.fc26                 ################################# [100%]
[root@sopuli Downloads]# rpm -Uvh dummy-1.0-2.fc26.noarch.rpm 
Preparing...                          ################################# [100%]
	file /usr/share/dummy/subdir from install of dummy-1.0-2.fc26.noarch conflicts with file from package dummy-1.0-1.fc26.noarch
[root@sopuli Downloads]#

So rpm is telling you this is not going to work. Forcing the issue with --replacefiles means you get to keep all the pieces -> NOTABUG.

Directory <-> symlink replacement cannot be done in %pre, you need to use %pretrans for that and then you dont need to force it. For testing purposes, it's sufficient to just replace the %pre in the dummy.spec with %pretrans.

For real-world packages you'd need to use the embedded Lua interpreter. See https://fedoraproject.org/wiki/Packaging:Directory_Replacement


Note You need to log in before you can comment on or make changes to this bug.