Re: Treating 'not found' packages as errors

Anders Blomdell <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
seth vidal wrote:
> On Thu, 2008-04-24 at 17:15 +0200, Anders Blomdell wrote:
>> seth vidal wrote:
>>> On Thu, 2008-04-24 at 11:44 +0200, Anders Blomdell wrote:
>>>
>>>> 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:
>>> Ah, what version of yum are you using?
>>>
>>> B/c the above is already fixed in HEAD and in the version released in
>>> fedora rawhide.
>> OK, found it in the git repository:
>>
>>         errors = self.ts.run(cb.callback, '')
>>         # ts.run() exit codes are, hmm, "creative": None means all ok, empty
>>         # list means some errors happened in the transaction and non-empty
>>         # list that there were errors preventing the ts from starting...
>>         if errors is None:
>>             pass
>>         elif len(errors) == 0:
>>             errstring = _('Warning: scriptlet or other non-fatal errors occurred
>> during transaction.')
>>             self.verbose_logger.debug(errstring)
>>         else:
>>             raise Errors.YumBaseError, errors
>>
>> Why doesn't 'len(errors) == 0' case not raise an exception?
> 
> b/c an empty list means there were scriptlet errors (%post, %pre, etc)
> and raising an exception there will break anaconda, as was discovered
> last week.
Understood, any reason against me trying to get rpm modified with something like:

--- rpm-4.4.2.2/python/rpmts-py.c~      2008-04-25 12:29:50.000000000 +0200
+++ rpm-4.4.2.2/python/rpmts-py.c       2008-04-25 12:37:02.000000000 +0200
@@ -1199,6 +1199,7 @@
 if (_rpmts_debug)
 fprintf(stderr, "*** rpmts_Run(%p) ts %p ignore %x\n", s, s->ts, s->ignoreSet);

+    errno = 0;
     rc = rpmtsRun(s->ts, NULL, s->ignoreSet);
     ps = rpmtsProblems(s->ts);

@@ -1214,6 +1215,10 @@

     if (rc < 0) {
        list = PyList_New(0);
+       if ((rc != -1) || (errno != 0)) {
+         PyList_Append(list,
+                       Py_BuildValue("s(ii)", "system error", rc, errno));
+       }
        return list;
     } else if (!rc) {
        Py_INCREF(Py_None);


I.e. Fill the return list with a possible system error (script errors seem to
leave errno set to 0, and in that case behaviour is unchanged).

Thanks for your patience.

/Anders


-- 
Anders Blomdell                  Email: [email protected]
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.