Bug 46439 - Problem of Script Execution Order when upgrading package
Problem of Script Execution Order when upgrading package
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
7.1
All Linux
high Severity medium
: ---
: ---
Assigned To: Jeff Johnson
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-06-28 12:52 EDT by James Su
Modified: 2007-03-26 23:46 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-01-17 15:32:18 EST
Type: ---
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 James Su 2001-06-28 12:52:30 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux 2.4.5-1.4 i686; en-US; rv:0.9.1)
Gecko/20010612

Description of problem:
The Script Execution Order for package upgrade of rpm (at lease 4.02) is:

  new-%pre      for new version of package being installed
  ...           (all new files are installed)
  new-%post     for new version of package being installed

  any-%triggerin (%triggerin from other packages set off by new install)
  new-%triggerin
  old-%triggerun
  any-%triggerun (%triggerun from other packages set off by old uninstall)

  old-%preun    for old version of package being removed
  ...           (all old files are removed)
  old-%postun   for old version of package being removed

  old-%triggerpostun
  any-%triggerpostun (%triggerpostun from other packages set off by old un
                install)

That is first install new package then erase old package.
But If there is some script in preun, postun or triggerun section in old
package to delete some config lines in some config files, the new config
lines wrote into the config file by new packages will perhaps be deleted by
old packages. For example I have a font package and there is a script in it
to add a FontDir entry into /etc/X11/XF86Config file, if I upgrade this
package, the FontDir entry will be deleted when erasing the old package.
Because the entry in old and new packages are same.

How reproducible:
Always

Steps to Reproduce:
1.install a package which will write something into a config file
2.upgrade this package with -U option
3.
	

Actual Results:  then the "something" will be deleted by postun script in
this package.
Because the old package was erased right after the new package was installed.

Expected Results:  when erasing the old package, any changes made by new
package's script should not be touched.

Additional info:

It seems that we should first erase the old package then install the new
package.
Comment 1 Jeff Johnson 2001-06-28 13:12:12 EDT
You need to distinguish between the upgrade and erase uses in %preun and %postun
by looking at argv[1]:

	%postun
	if [ $1 == 0 ]; then
	    <this is where the package erase actions are performed>
	else
	    <this is where the package upgrade actions are performed>
	endif

There are similar, though much more complicated, conventions using $1 and $2
args
for %triggerun, see the description of triggers in the rpm-devel package for
gory details.
Comment 2 Isaiah Weiner 2002-01-17 15:32:13 EST
But it still doesn't explain why the postun section of the RPM is being run 
AFTER the newer package is installed (and after the newer package's %post 
section is run).  My customer is experiencing this as well, and it's biten them 
twice.  Do you plan to change this behavior?
Comment 3 Jeff Johnson 2002-02-02 11:47:39 EST
rpm has always installed before erasing, and this is not going to change.

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