Bug 966715 - Reinstalling a package with rpm -i --excludedocs --replacepkgs does not remove docs.
Reinstalling a package with rpm -i --excludedocs --replacepkgs does not remov...
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
20
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
:
: 1062956 (view as bug list)
Depends On:
Blocks: 1062957 1071854
  Show dependency treegraph
 
Reported: 2013-05-23 14:31 EDT by Sandro Mani
Modified: 2015-06-12 07:52 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-06-12 07:52:33 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sandro Mani 2013-05-23 14:31:17 EDT
Description of problem:
Reinstalling a package with --excludedocs leaves docs behind on system (even after removing the reinstalled package).

Version-Release number of selected component (if applicable):
rpm-4.11.0.1-6.fc20.x86_64

How reproducible:
Always

Steps to Reproduce:
1. $ yumdownloader nano
nano-2.3.2-2.fc20.x86_64.rpm
2. # rpm -i nano-2.3.2-2.fc20.x86_64.rpm
3. $ test -e /usr/share/doc/nano-2.3.2/ && echo "Exists"
Exists
4. # rpm -i --excludedocs --replacepkgs nano-2.3.2-2.fc20.x86_64.rpm
5. $ test -e /usr/share/doc/nano-2.3.2/ && echo "Exists"
Exists
6. # rpm -e nano
7. $ test -e /usr/share/doc/nano-2.3.2/ && echo "Exists"
Exists
8. $ rpm -qa nano | wc -l
0

Actual results:
Stray docs

Expected results:
Docs removed when issuing rpm -i --excludedocs --replacepkg

Additional info:
Same issue can be reproduced with yum:
1. $ grep tsflags /etc/yum.conf
# tsflags=nodocs
2. # yum install nano
3. $ test -e /usr/share/doc/nano-2.3.2/ && echo "Exists
Exists
4. # sed -i 's|# tsflags=nodocs|tsflags=nodocs|' /etc/yum.conf
5. # yum reinstall nano
6. $ test -e /usr/share/doc/nano-2.3.2/ && echo "Exists
Exists
7. # yum erase nano
8. $ test -e /usr/share/doc/nano-2.3.2/ && echo "Exists"
Exists
9. $ rpm -qa nano | wc -l
0

That is, setting tsflags=nodocs before reinstalling will result in stray docs.

Also note that the issue only occurs when reinstalling a package (not when removing and then installing again).
Comment 1 Harald Reindl 2013-05-23 14:39:51 EDT
the same applies to Fedora 17 and the real interesting question is what happens due a "yum distro-sync" to F18

in the best case installed doc-files of F17 packages are removed and not installed in their F18 version

in the worst case they even get not removed if they are no longer in the package

"tsflags=nodocs" in /etc/yum.conf

it would make virtual infrastructures so much smaller to get rid of docs/manpages and have them only on the admin workstation but not on the whole infrastructure especially in case of full-backups
Comment 2 Panu Matilainen 2013-05-23 14:55:50 EDT
Okay so its only with 'yum reinstall' or 'rpm ---replacepkgs' where this occurs. 
Since that's the case this is "expected behavior" (known bug if you like): --replacepkgs bypasses most normal update-style paths and leaving orphan files behind in various circumstances is a known issue. Changing --replacepkgs to behave more like a normal update (only to the same version) has been on my todo list for some time now, just hasn't gotten done.

Anyway, since its limited to --replacepkgs/reinstall then there are no surprises (to me) involved.
Comment 3 Fedora End Of Life 2013-09-16 10:00:19 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle.
Changing version to '20'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20
Comment 4 Panu Matilainen 2014-02-09 09:02:38 EST
*** Bug 1062956 has been marked as a duplicate of this bug. ***
Comment 5 Panu Matilainen 2014-02-10 07:21:51 EST
BTW note that 'rpm -i' must never remove anything (packages nor files), so the exact reproducer command is not going to behave the way described in "expected results", but leaving orphan files behind is obviously a bug. There are roughly two parts to this:

- rpm should refuse an operation which would leave orphan files behind, so -i in such a situation should error out
- rpm needs proper reinstall functionality, technically behaving like an update (but to the already installed version) with separate install and erase transaction elements which allows file removals due to changed docs/langs etc policies etc properly handled.
Comment 6 Harald Reindl 2014-02-10 07:27:03 EST
thanks for feedback!

rm -rf /usr/share/doc/*; rm -rf /usr/share/man/*; yum reinstall filesystem
is by the way a workaround to get "tsflags=nodocs" applied in a existing setup
Comment 7 Panu Matilainen 2014-03-04 07:05:36 EST
This use-case is now fixed upstream by adding a new --reinstall command which properly handles changing file policies and such:

[root@localhost rpm]# ./rpm -U nano-2.3.2-4.fc20.x86_64.rpm 
[root@localhost rpm]# ls /usr/share/doc/nano/
AUTHORS  ChangeLog  faq.html  nanorc.sample  README  TODO
BUGS     COPYING    INSTALL   NEWS           THANKS
[root@localhost rpm]# ./rpm --reinstall --nodocs nano-2.3.2-4.fc20.x86_64.rpm
[root@localhost rpm]# ls /usr/share/doc/nano/
ls: cannot access /usr/share/doc/nano/: No such file or directory
[root@localhost rpm]# ./rpm -q --state nano|head -5
normal        /etc/nanorc
normal        /usr/bin/nano
normal        /usr/bin/rnano
not installed /usr/share/doc/nano
not installed /usr/share/doc/nano/AUTHORS
[root@localhost rpm]#

Now I just need to figure what to do about --replacepkgs switch, as its "semantics" are rather peculiar...
Comment 8 Harald Reindl 2014-03-04 07:09:59 EST
thank you for feedback
Comment 9 Fedora End Of Life 2015-05-29 05:04:42 EDT
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 10 Florian Festi 2015-06-12 07:52:33 EDT
Moved the considerations about the future of --replacepkgs to http://rpm.org/ticket/893

Closing as the actual problem is fixed.

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