Bug 30795

Summary: Wrong rpm -U script run order
Product: [Retired] Red Hat Linux Reporter: Péter, Soós <sp>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-03-06 10:29:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Péter, Soós 2001-03-06 10:28:51 UTC
If you upgrade a package with %pre, %post, %preun, %postun, scripts by
command rpm -U package_name the uninstall scripts (e.g. %postun) of old
package runs after the install script of the new package. For example the
new package make changes in configuration files but the old removes them...

Reproducible: In some cases

Steps to Reproduce:
1. Get a package with scripts (e.g. vacation from contrib)
2. Install it
3. Build a new release
4. Upgrade it with rpm -U

Workaround:
User rpm -e after rpm -i to upgrade a package, but in case of more complex
package dependencies it is problematic.

Comment 1 Jeff Johnson 2001-03-06 14:01:12 UTC
Yes, rpm installs before remove.

The order of script execution (including triggers) is in
/usr/share/doc/rpm-*/triggers

Comment 2 Martin Craig 2004-11-18 11:31:55 UTC
I'm surprised this is NOTABUG - I have just come across it myself and
the behaviour, although as documented, is very non-intuitive. 

In my case the postinstall script copies a file to a predefined
location and the postuninstall removes it. This means that on upgrade
the file is copied and then deleted by the removal of the old package!

Is there a workaround apart from not using rpm -U ?