Bug 158577 - Sorted erase only transactions should not be reversed
Sorted erase only transactions should not be reversed
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
:
: 135048 154069 (view as bug list)
Depends On:
Blocks: FC6Blocker
  Show dependency treegraph
 
Reported: 2005-05-23 14:53 EDT by Paul Nasrat
Modified: 2014-01-21 17:52 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-04-13 17:39:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Results of "yum remove libgcj" (3.42 KB, text/plain)
2005-05-25 10:43 EDT, Ville Skyttä
no flags Details
Debug output of "yum remove libgcj" (332.79 KB, text/plain)
2005-05-25 11:20 EDT, Ville Skyttä
no flags Details

  None (edit)
Description Paul Nasrat 2005-05-23 14:53:20 EDT
+++ 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 14:55:54 EDT
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 15:30:46 EDT
FYI, this happens also with apt, so automagic in rpmlib would be cool.
Comment 3 Paul Nasrat 2005-05-24 13:30:03 EDT
Workaround for FC4 in yum, will address properly in rpmlib for fc5 

yum-2.3.2-6
Comment 4 Ville Skyttä 2005-05-25 10:40:53 EDT
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 10:43:48 EDT
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 10:56:23 EDT
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 10:57:42 EDT
For reference my test specs requirer and required are at
http://people.redhat.com/pnasrat/
Comment 8 Ville Skyttä 2005-05-25 11:11:13 EDT
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 11:20:21 EDT
Created attachment 114830 [details]
Debug output of "yum remove libgcj"
Comment 10 Paul Nasrat 2005-05-25 12:04:23 EDT
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 14:01:07 EDT
Actually we need not to reverse them in rpm, plus an update for bug #155700
Comment 12 Paul Nasrat 2005-05-25 14:02:07 EDT
Dropped bogus yum patch
Comment 13 Paul Nasrat 2005-09-26 18:12:13 EDT
*** Bug 154069 has been marked as a duplicate of this bug. ***
Comment 14 Paul Nasrat 2005-11-28 17:18:19 EST
*** Bug 135048 has been marked as a duplicate of this bug. ***
Comment 15 Jeff Johnson 2006-04-13 17:39:36 EDT
Fixed in rpm-4.4.6.

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