Bug 484729 - rpm transaction callback api has changed
Summary: rpm transaction callback api has changed
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Seth Vidal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 485373 487440 513013 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-09 17:54 UTC by Kevin Fenzi
Modified: 2014-01-21 23:08 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-02-24 22:00:09 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Kevin Fenzi 2009-02-09 17:54:03 UTC
Updating my ppc32 rawhide box today: 

root@mavra: Loaded plugins: refresh-packagekit
root@mavra: Setting up Update Process
root@mavra: Resolving Dependencies
root@mavra: There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
root@mavra: --> Running transaction check
root@mavra: ---> Package glx-utils.ppc 0:7.3-1.fc11 set to be updated
root@mavra: ---> Package kernel.ppc 0:2.6.29-0.96.rc3.git12.fc11 set to be installed
root@mavra: ---> Package kernel-bootwrapper.ppc 0:2.6.29-0.96.rc3.git12.fc11 set to be updated
root@mavra: ---> Package kernel-firmware.noarch 0:2.6.29-0.96.rc3.git12.fc11 set to be updated
root@mavra: ---> Package kernel-headers.ppc 0:2.6.29-0.96.rc3.git12.fc11 set to be updated
root@mavra: ---> Package libxcb.ppc 0:1.1.93-3.fc11 set to be updated
root@mavra: ---> Package libxcb-devel.ppc 0:1.1.93-3.fc11 set to be updated
root@mavra: ---> Package linuxwacom.ppc 0:0.8.2.2-2.fc11 set to be updated
root@mavra: ---> Package mesa-dri-drivers.ppc 0:7.3-1.fc11 set to be updated
root@mavra: ---> Package mesa-libGL.ppc 0:7.3-1.fc11 set to be updated
root@mavra: ---> Package mesa-libGL-devel.ppc 0:7.3-1.fc11 set to be updated
root@mavra: ---> Package mesa-libGLU.ppc 0:7.3-1.fc11 set to be updated
root@mavra: ---> Package obex-data-server.ppc 1:0.4.3-1.fc11 set to be updated
root@mavra: ---> Package rhpxl.ppc 0:1.12-1.fc11 set to be updated
root@mavra: ---> Package system-config-display.noarch 0:1.1.3-1.fc11 set to be updated
root@mavra: ---> Package xorg-x11-drv-cirrus.ppc 0:1.2.0-3.fc11 set to be updated
root@mavra: ---> Package xorg-x11-drv-mga.ppc 0:1.4.9-1.fc11 set to be updated
root@mavra: ---> Package xorg-x11-drv-synaptics.ppc 0:1.0.0-3.fc11 set to be updated
root@mavra: ---> Package xorg-x11-server-Xorg.ppc 0:1.5.99.902-5.fc11 set to be updated
root@mavra: ---> Package xorg-x11-server-common.ppc 0:1.5.99.902-5.fc11 set to be updated
root@mavra: --> Finished Dependency Resolution
root@mavra: --> Running transaction check
root@mavra: ---> Package kernel.ppc 0:2.6.29-0.74.rc3.git3.fc11 set to be erased
root@mavra: --> Finished Dependency Resolution
root@mavra: Dependencies Resolved
root@mavra: ================================================================================
root@mavra: Package                 Arch    Version                       Repository  Size
root@mavra: ================================================================================
root@mavra: Installing:
root@mavra: kernel                  ppc     2.6.29-0.96.rc3.git12.fc11    rawhide     25 M
root@mavra: Updating:
root@mavra: glx-utils               ppc     7.3-1.fc11                    rawhide     46 k
root@mavra: kernel-bootwrapper      ppc     2.6.29-0.96.rc3.git12.fc11    rawhide    314 k
root@mavra: kernel-firmware         noarch  2.6.29-0.96.rc3.git12.fc11    rawhide    451 k
root@mavra: kernel-headers          ppc     2.6.29-0.96.rc3.git12.fc11    rawhide    769 k
root@mavra: libxcb                  ppc     1.1.93-3.fc11                 rawhide    129 k
root@mavra: libxcb-devel            ppc     1.1.93-3.fc11                 rawhide    145 k
root@mavra: linuxwacom              ppc     0.8.2.2-2.fc11                rawhide    248 k
root@mavra: mesa-dri-drivers        ppc     7.3-1.fc11                    rawhide    1.4 M
root@mavra: mesa-libGL              ppc     7.3-1.fc11                    rawhide    206 k
root@mavra: mesa-libGL-devel        ppc     7.3-1.fc11                    rawhide    462 k
root@mavra: mesa-libGLU             ppc     7.3-1.fc11                    rawhide    218 k
root@mavra: obex-data-server        ppc     1:0.4.3-1.fc11                rawhide     85 k
root@mavra: rhpxl                   ppc     1.12-1.fc11                   rawhide     93 k
root@mavra: system-config-display   noarch  1.1.3-1.fc11                  rawhide    192 k
root@mavra: xorg-x11-drv-cirrus     ppc     1.2.0-3.fc11                  rawhide     43 k
root@mavra: xorg-x11-drv-mga        ppc     1.4.9-1.fc11                  rawhide     95 k
root@mavra: xorg-x11-drv-synaptics  ppc     1.0.0-3.fc11                  rawhide     61 k
root@mavra: xorg-x11-server-Xorg    ppc     1.5.99.902-5.fc11             rawhide    1.6 M
root@mavra: xorg-x11-server-common  ppc     1.5.99.902-5.fc11             rawhide     39 k
root@mavra: Removing:
root@mavra: kernel                  ppc     2.6.29-0.74.rc3.git3.fc11     installed   64 M
root@mavra: Transaction Summary
root@mavra: ================================================================================
root@mavra: Install      1 Package(s)
root@mavra: Update      19 Package(s)
root@mavra: Remove       1 Package(s)
root@mavra: Total download size: 32 M
root@mavra: Downloading Packages:
root@mavra: --------------------------------------------------------------------------------
root@mavra: Total                                           1.7 MB/s |  32 MB     00:19
root@mavra: Running rpm_check_debug
root@mavra: Running Transaction Test
root@mavra: Finished Transaction Test
root@mavra: Transaction Test Succeeded
root@mavra: Running Transaction
  Updating       : libxcb                                                  1/43
  Updating       : mesa-dri-drivers                                        2/43
  Updating       : mesa-libGL                                              3/43
  Updating       : mesa-libGLU                                             4/43
  Updating       : glx-utils                                               5/43
  Updating       : obex-data-server                                        6/43
  Updating       : kernel-bootwrapper                                      7/43
  Updating       : xorg-x11-server-common                                  8/43
  Updating       : kernel-firmware                                         9/43
  Updating       : mesa-libGL-devel                                       10/43
  Updating       : libxcb-devel                                           11/43
  Updating       : kernel-headers                                         12/43
  Updating       : xorg-x11-server-Xorg                                   13/43
  Updating       : rhpxl                                                  14/43
  Updating       : linuxwacom                                             15/43
  Updating       : xorg-x11-drv-cirrus                                    16/43
  Installing     : kernel                                                 17/43
  Updating       : xorg-x11-drv-mga                                       18/43
  Updating       : system-config-display                                  19/43gtk-update-icon-cache: Failed to open file /usr/share/icons/hicolor/.icon-theme.cache : File exists
root@mavra: Non-fatal POSTIN scriptlet failure in rpm package system-config-display-1.1.3-1.fc11.noarch
root@mavra: warning: %post(system-config-display-1.1.3-1.fc11.noarch) scriptlet failed, exit status 1
  Updating       : xorg-x11-drv-synaptics                                 20/43
  Cleanup        : xorg-x11-drv-cirrus                                    21/43
  Cleanup        : glx-utils                                              22/43
  Cleanup        : kernel-bootwrapper                                     23/43
  Cleanup        : kernel-headers                                         24/43
  Cleanup        : mesa-libGL                                             25/43
  Cleanup        : linuxwacom                                             26/43
  Cleanup        : xorg-x11-server-common                                 27/43
  Cleanup        : mesa-libGLU                                            28/43
  Cleanup        : libxcb-devel                                           29/43
  Cleanup        : xorg-x11-drv-mga                                       30/43
  Cleanup        : system-config-display                                  31/43gtk-update-icon-cache: Failed to open file /usr/share/icons/hicolor/.icon-theme.cache : File exists
root@mavra: Traceback (most recent call last):
root@mavra: File "/usr/lib/python2.6/site-packages/yum/rpmtrans.py", line 389, in callback
root@mavra: self._scriptError(bytes, total, h)
root@mavra: File "/usr/lib/python2.6/site-packages/yum/rpmtrans.py", line 509, in _scriptError
root@mavra: (hdr, rpmloc) = h
root@mavra: ValueError: too many values to unpack
root@mavra: error: python callback <bound method RPMTransaction.callback of <yum.rpmtrans.RPMTransaction instance at 0x1195a6e8>> failed, aborting!

A yum-complete-transaction fails the same way now. 
This doesn't seem to happen on my x86 rawhide hosts. ;(

Comment 1 James Antill 2009-02-09 18:06:01 UTC
 I have a workaround, although I'm not sure if we should use it. Basically it does:

commit 8b750270e0e9549288db54cc011484aee518d30e
Author: James Antill <james>
Date:   Mon Feb 9 13:04:11 2009 -0500

    Let the fourth arg. to the rpm callback expand to more than 2 things

diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 85896fa..81e1672 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -406,7 +406,7 @@ class RPMTransaction:
         self.lastmsg = None
         hdr = None
         if h is not None:
-            hdr, rpmloc = h
+            hdr, rpmloc = h[0], h[1]
             handle = self._makeHandle(hdr)
             fd = os.open(rpmloc, os.O_RDONLY)
             self.filehandles[handle]=fd
[...]
@@ -506,7 +506,7 @@ class RPMTransaction:
             # right behavior should be
                 
     def _scriptError(self, bytes, total, h):
-        (hdr, rpmloc) = h
+        (hdr, rpmloc) = h[0], h[1]
         pkgtup = self._dopkgtup(hdr)
         txmbrs = self.base.tsInfo.getMembers(pkgtup=pkgtup)
         for txmbr in txmbrs:

...Panu or Florian is this the right thing to do? What is the 3rd thing in that tuple/list?

Comment 2 Panu Matilainen 2009-02-10 10:45:06 UTC
The issue is that in the case of erasure callbacks, there's just one item there but the one thing happens to be a string (the name of the package):

>>> h = "packagename"
>>> (hdr, rpmloc) = h
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack

The kinda new twist here is that unlike the other callback types, RPMCALLBACK_SCRIPT_ERROR can (and does) happen on both install/upgrade and erase.
And it does mean that for %preun and %postun scriptlets, you can't reliably determine which of the packages failed as you only have the name available (essentially the same thing as bug 468418). My bad when introducing _scriptError(), didn't remember the python callback was sooooo broken.

What fun...

Comment 3 seth vidal 2009-02-10 15:26:53 UTC
If we're going to be breaking things anyway? How about we switch it so it passes the erased nevra instead of the name as a string. We can treat it the same in yum but ideally report more information in the short term.

Comment 4 seth vidal 2009-02-13 14:51:12 UTC
note: 485373 - looks a lot like this but for i686.

Comment 5 Dave Airlie 2009-02-17 02:46:45 UTC
me too, just tagging in to know when it gets fixed.

Comment 6 seth vidal 2009-02-20 13:53:27 UTC
*** Bug 485373 has been marked as a duplicate of this bug. ***

Comment 7 seth vidal 2009-02-20 13:55:24 UTC
Panu,
 So do we need to fix this in yum or are you planning on fixing it in rpm/python bindings - b/c we've gotten 3 bugs with the same behavior, now.

Comment 8 seth vidal 2009-02-24 22:00:09 UTC
okay, on Florian's suggestion I checked in slightly more than james' patch.

It's mostly just covers all the places where we look at the value and assume it is a 2-item tuple.

Comment 9 Panu Matilainen 2009-02-25 05:45:51 UTC
Mm.. the rpm callback api didn't really change, it gives you precisely the same things as before. See comment #2, the catch here is that unlike the other callback cases, the new RPMCALLBACK_SCRIPT_ERROR can happen on both install and erase, and install vs erase callback arguments are different, always been.

It'd be possible to add some sort of kludge to optionally give the full NEVRA on erase callback instead of just name, but that wont change the number of arguments you get. Again, my bad for not taking the install/erase difference into account when introducing _scriptError() in the yum patch, but rpm/python-side can't much help this without making a completely incompatible change to the callback api.

Comment 10 seth vidal 2009-02-26 05:11:04 UTC
*** Bug 487440 has been marked as a duplicate of this bug. ***

Comment 11 seth vidal 2009-09-03 15:58:27 UTC
*** Bug 513013 has been marked as a duplicate of this bug. ***

Comment 12 Fedora Update System 2009-09-30 01:37:53 UTC
yum-3.2.24-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2009-10-19 16:44:52 UTC
yum-3.2.24-2.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/yum-3.2.24-2.fc10

Comment 14 Fedora Update System 2009-11-04 12:05:07 UTC
yum-3.2.24-2.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.


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