[Yum] Treating 'not found' packages as errors

Anders Blomdell anders.blomdell at control.lth.se
Thu Apr 24 09:44:38 UTC 2008


Anders Blomdell wrote:
> seth vidal wrote:
>> On Wed, 2008-04-23 at 21:15 +0200, Anders Blomdell wrote:
>>> seth vidal wrote:
>>>> On Wed, 2008-04-23 at 21:02 +0200, Anders Blomdell wrote:
>>>>> I have already found that out, the problem is that my.processTransaction()
>>>>> silently refuses to install.
>>>>> xpdf
>>>>> xwnc
>>>>> 10 Downloading Packages ()
>>>>> 11 11 ([<yum.sqlitesack.YumAvailablePackageSqlite object at 0x956744c>,
>>>>> <yum.sqlitesack.YumAvailablePackageSqlite object at 0xc525bac>],)
>>>>> 20 Check Package Signatures ()
>>>>> 30 Running Test Transaction ()
>>>>> Running rpm_check_debug
>>>>> 40 Running Transaction ()
>>>> Well, in the case of the user - the transaction cannot be run, at all...
>>>> Is that what you mean - when it is run as a user it is silent in its
>>>> not-running-ness?
>>> Exactly, and it makes me nervous that other things will silently be ignored as
>>> well (even when running as root). I did not expect it to install anything when
>>> run as an ordinary user, but I would like to get informed of what it couldn't
>>> complete (which somehow brings me back to what started this thread).
>>>
>> understood - if you break up what processTransaction() does you can get
>> more feedback. However, things like the above are why we're going to be
>> workin specific items to break in the yum api to make programming to it
>> better and more reliable.
>>
>>
>> If you're interested in adding some input it's welcome.
> With the following change to runTransaction in __init__.py:
> 
>         import sys
>         print >> sys.stderr, "Before"
>         errors = self.ts.run(cb.callback, '')
>         print >> sys.stderr, "After",errors
> 
> This is what I get from an strace:
> 
> write(2, "Before", 6)                   = 6
> write(2, "\n", 1)                       = 1
> futex(0x81ee458, FUTEX_WAKE, 1)         = 0
> umask(022)                              = 022
> open("/var/lib/rpm/__db.000", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = -1 EACCES (Per
> mission denied)
> umask(022)                              = 022
> open("/var/lib/rpm/__db.000", O_RDONLY|O_LARGEFILE) = 18
> write(17, "error: can\'t create transaction "..., 62) = 62
> close(18)                               = 0
> write(2, "After", 5)                    = 5
> write(2, " ", 1)                        = 1
> write(2, "[", 1)                        = 1
> write(2, "]", 1)                        = 1
> write(2, "\n", 1)                       = 1
> 
> All very reasonable, except for the fact that no errors are returned. To me it
> looks like rpmUtils is to blame.

OK, found it. Kind of shared error, fix is:

--- __init__.py~        2007-12-05 23:27:40.000000000 +0100
+++ __init__.py 2008-04-24 11:40:59.000000000 +0200
@@ -589,7 +589,7 @@
         self.plugins.run('pretrans')

         errors = self.ts.run(cb.callback, '')
-        if errors:
+        if errors != None:
             raise Errors.YumBaseError, errors

         if not self.conf.keepcache:


Reason for bug is non-obvious error return from rpmts_Run (rpmts-py.c) and
python regarding 'if []:' and 'if None:' as equivalent:

  if (rc < 0) {
        list = PyList_New(0);
        return list;
    } else if (!rc) {
        Py_INCREF(Py_None);
        return Py_None;
    }

Best regards

Anders Blomdell

-- 
Anders Blomdell                  Email: anders.blomdell at control.lth.se
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden



More information about the Yum mailing list