[Yum-devel] [PATCH] If verifyTransaction detects that a removal was not successful, it will now set the output_state of the pkg to TS_FAILED. BZ 661962

Nick Jacek njacek at redhat.com
Wed Jun 15 20:37:06 UTC 2011


Install actually works correctly, so I don't think anything should be changed a few lines up.  I believe this is because where these errors happen, functions like _scriptError etc. get called in rpmtrans.py.  They have a few lines like

if total:
            msg = ("Error in %s scriptlet in rpm package %s" % 
                    (scriptlet_name, package_name))
            if txmbr is not None:        
                txmbr.output_state = TS_FAILED

The difference is that in the case of install, txmbr is a transaction member, but in the case of remove, txmbr is None, so the output_state isn't set to TS_FAILED, even thought it is in the case of an install.  It seems to me that ideally these functions would set TS_FAILED for both installs and removals, but in these functions txmbr is set via

name, txmbr = self._getTxmbr(h)

and a comment on _getTxmbr states that 
      On erasures we dont know
    # the exact txmbr but we always have a name, so return (name, txmbr)
    # tuples so callers have less twists to deal with.

So it seems like the difference is caused by something about the way that rpm works?




----- Original Message -----
From: "James Antill" <james at fedoraproject.org>
To: "yum development" <yum-devel at lists.baseurl.org>
Sent: Wednesday, June 15, 2011 3:43:59 PM
Subject: Re: [Yum-devel] [PATCH] If verifyTransaction detects that a removal was not successful, it will now set the output_state of the pkg to TS_FAILED. BZ 661962

On Wed, 2011-06-15 at 14:38 -0400, Nick Jacek wrote:
> Since the output_state will be TS_FAILED rather than just remaining
> TS_ERASE, yum will now correctly say that the removal failed instead of
> saying that the package was removed.
> ---
>  yum/__init__.py |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)

 This looks pretty good, but there's a similar spot for install a few
lines up ... we should also get rpm fixed :).

> diff --git a/yum/__init__.py b/yum/__init__.py
> index a0c6b9d..29be93d 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -1650,6 +1650,7 @@ class YumBase(depsolve.Depsolve):
>                          # but raising an exception is not going to do any good
>                          self.logger.critical(_('%s was supposed to be removed' \
>                                                 ' but is not!' % txmbr.po))
> +                        txmbr.output_state = TS_FAILED
>                          continue
>                  yumdb_item = self.rpmdb.yumdb.get_package(po=txmbr.po)
>                  yumdb_item.clean()


_______________________________________________
Yum-devel mailing list
Yum-devel at lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel


More information about the Yum-devel mailing list