Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 158577

Summary: Sorted erase only transactions should not be reversed
Product: [Fedora] Fedora Reporter: Paul Nasrat <pnasrat>
Component: rpmAssignee: Paul Nasrat <pnasrat>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: fedora, gbritton, katzj, mefoster, mlists, rdieter, rolwi, scop, stickster
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-04-13 21:39:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 150224    
Attachments:
Description Flags
Results of "yum remove libgcj"
none
Debug output of "yum remove libgcj" none

Description Paul Nasrat 2005-05-23 18:53:20 UTC
+++ This bug was initially created as a clone of Bug #155700 +++

The code path for python erase differs from rpm -e:

java-1.4.2-gcj-compat got removed before ant and eclipse-gcj in the transaction,
causing breakage:

  [...]
  Removing  : java-1.4.2-gcj-compat        ####################### [ 5/12]
  [...]
  Removing  : ant                          ####################### [11/12]
/home/scop/rpmbuild/tmp/rpm-tmp.15391: line 1: rebuild-gcj-db: command not found
error: %postun(ant-1.6.2-3jpp_6fc.i386) scriptlet failed, exit status 127
  Removing  : eclipse-ecj                  ####################### [12/12]
/home/scop/rpmbuild/tmp/rpm-tmp.15391: line 1: /usr/bin/rebuild-gcj-db: No such
file or directory
error: %postun(eclipse-ecj-3.1.0_fc-0.M6.20.i386) scriptlet failed, exit status 127

At least ant, eclipse* and mx4j in FC devel use the "Requires(foo,bar)" syntax
to ensure rebuild-gcj-db is available at scriptlet time.  Maybe the earlier
workaround of splitting that into two: "Requires(foo): ..." and "Requires(bar):
..." should be applied in them (and other affected packages) until it's really
fixed in rpm.


Checking header:

Requires(post,postun): java-1.4.2-gcj-compat >= 1.4.2.0-40jpp_16rh

rpm --qf '[%{REQUIRENAME} %{REQUIREFLAGS}\n]' -qp mx4j-2.1.0-1jpp_7fc.i386.rpm 
| grep comp
java-1.4.2-gcj-compat 5196

>>> x = rpm.RPMSENSE_SCRIPT_POSTUN
>>> x |= rpm.RPMSENSE_SCRIPT_POST
>>> x |= rpm.RPMSENSE_GREATER
>>> x |= rpm.RPMSENSE_EQUAL
>>> x
5196

Test erase ordering:

Install
D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth,
breadth)
D:     0    0    1    0    1    0   +required-1.2-1.noarch
D: ========== successors only (1938 bytes)
D:     1    1    0    0    2    0     +requirer-2.0-1.noarch

Erase:
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth,
breadth)
D:     0    0    0    1    1    0   -required-1.2-1.noarch
D: ========== successors only (0 bytes)
D:     1    0    0    0    1    1   -requirer-2.0-1.noarch
D: mounted filesystems:

rpm sorts that fine for me with a single dep.

Running Transaction
  Removing  : required                     ######################### [1/2]
  Removing  : requirer                     ######################### [2/2]
/var/tmp/rpm-tmp.39887: line 1: /usr/opt/required/required: No such file or
directory
error: %postun(requirer-2.0-1.noarch) scriptlet failed, exit status 1

Removed: required.noarch 0:1.2-1 requirer.noarch 0:2.0-1

Comment 1 Paul Nasrat 2005-05-23 18:55:54 UTC
Looking at rpminstall.c vs. yums code - the difference is we would need (atm)

ts.setFlags(rpm.RPMTRANS_FLAG_REVERSE)

for erase only transactions

I'll also look into whether we can make the sorting algorithm do this automagically.


Comment 2 Ville Skyttä 2005-05-23 19:30:46 UTC
FYI, this happens also with apt, so automagic in rpmlib would be cool.

Comment 3 Paul Nasrat 2005-05-24 17:30:03 UTC
Workaround for FC4 in yum, will address properly in rpmlib for fc5 

yum-2.3.2-6

Comment 4 Ville Skyttä 2005-05-25 14:40:53 UTC
2.3.2-6 looks much _worse_ than before.  I'm testing with successive "yum -y
install ant" and "yum -y remove libgcj" runs (and because the latter fails to
properly remove ant due to breakage, "rpm -e --noscripts ant" in between before
the next "yum install"). 


Comment 5 Ville Skyttä 2005-05-25 14:43:48 UTC
Created attachment 114826 [details]
Results of "yum remove libgcj"

Here are the results of my "yum remove libgcj".

Note for example that the whole dependency chain here depends on libgcj, but it
is being removed much too early.

Comment 6 Paul Nasrat 2005-05-25 14:56:23 UTC
Ville can you edit /usr/lib/python2.4/site-packages/rpmUtils/__init__.py

at the top just after the imports put 

rpm.setVerbosity(rpm.RPMLOG_DEBUG) 

and rerun the test, attaching output here.

Comment 7 Paul Nasrat 2005-05-25 14:57:42 UTC
For reference my test specs requirer and required are at
http://people.redhat.com/pnasrat/

Comment 8 Ville Skyttä 2005-05-25 15:11:13 UTC
Will do.  I was already checking in what order should my test transaction
proceed, so I'll post that first.  This is the correct erase sequence for it:

1) ant
2) java-1.4.2-gcj-compat-devel
3) eclipse-ecj
4) jessie and java-1.4.2-gcj-compat (dependency loop)
5) gjdoc or gnu-crypto (both, but order does not matter)
6) gnu-crypto-jce-jdk1.4 or gnu-crypto-sasl-jdk1.4 (both, but order does not matter)
7) gcc-java
8) libgcj-devel
9) libgcj

There's some weird %postun error when removing eclipse-ecj using this sequence,
but that's probably unrelated and could be a missing dep elsewhere.

Comment 9 Ville Skyttä 2005-05-25 15:20:21 UTC
Created attachment 114830 [details]
Debug output of "yum remove libgcj"

Comment 10 Paul Nasrat 2005-05-25 16:04:23 UTC
The relevant part for rpm is:

D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth,
breadth)
D:     0    0    0   11    1    0   -eclipse-ecj-3.1.0_fc-0.M7.5.i386
D: ========== successors only (0 bytes)
D:     1    0    0    0    1    1   -jessie-1.0.0-7.noarch
D:     2    0    0    1    1    2   -gnu-crypto-jce-jdk1.4-2.0.1-1jpp_4fc.noarch
D:     3    0    0    2    1    3   -gnu-crypto-sasl-jdk1.4-2.0.1-1jpp_4fc.noarch
D:     4    0    0    3    1    4   -java-1.4.2-gcj-compat-1.4.2.0-40jpp_24rh.i386
D:     5    0    0    4    1    5   -gnu-crypto-2.0.1-1jpp_4fc.noarch
D:     6    0    0    5    1    6   -libgcj-devel-4.0.0-8.i386
D:     7    0    0    6    1    7   -gcc-java-4.0.0-8.i386
D:     8    0    0    7    1    8   -ant-1.6.2-3jpp_8fc.i386
D:     9    0    0    8    1    9   -gjdoc-0.7.4-5.i386
D:    10    0    0    9    1   10   -libgcj-4.0.0-8.i386
D:    11    0    0   10    1   11  
-java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp_24rh.i386

Running rpm -evv --test on the package set:

D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth,
breadth)
D:     0    0    0   11    1    0   -gjdoc-0.7.4-5.i386
D: ========== successors only (0 bytes)
D:     1    0    0    0    1    1   -libgcj-4.0.0-8.i386
D:     2    0    0    1    1    2  
-java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp_24rh.i386
D:     3    0    0    2    1    3   -eclipse-ecj-3.1.0_fc-0.M7.5.i386
D:     4    0    0    3    1    4   -jessie-1.0.0-7.noarch
D:     5    0    0    4    1    5   -gnu-crypto-jce-jdk1.4-2.0.1-1jpp_4fc.noarch
D:     6    0    0    5    1    6   -gnu-crypto-sasl-jdk1.4-2.0.1-1jpp_4fc.noarch
D:     7    0    0    6    1    7   -java-1.4.2-gcj-compat-1.4.2.0-40jpp_24rh.i386
D:     8    0    0    7    1    8   -gnu-crypto-2.0.1-1jpp_4fc.noarch
D:     9    0    0    8    1    9   -libgcj-devel-4.0.0-8.i386
D:    10    0    0    9    1   10   -gcc-java-4.0.0-8.i386
D:    11    0    0   10    1   11   -ant-1.6.2-3jpp_8fc.i386


Comment 11 Paul Nasrat 2005-05-25 18:01:07 UTC
Actually we need not to reverse them in rpm, plus an update for bug #155700

Comment 12 Paul Nasrat 2005-05-25 18:02:07 UTC
Dropped bogus yum patch

Comment 13 Paul Nasrat 2005-09-26 22:12:13 UTC
*** Bug 154069 has been marked as a duplicate of this bug. ***

Comment 14 Paul Nasrat 2005-11-28 22:18:19 UTC
*** Bug 135048 has been marked as a duplicate of this bug. ***

Comment 15 Jeff Johnson 2006-04-13 21:39:36 UTC
Fixed in rpm-4.4.6.