From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 275E4E00CF4; Wed, 25 May 2016 02:56:31 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [212.223.36.35 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 HTML_MESSAGE BODY: HTML included in message Received: from good-out-20.clustermail.de (good-out-20.clustermail.de [212.223.36.35]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 8AA70E00CDE for ; Wed, 25 May 2016 02:56:26 -0700 (PDT) Received: from frontend-06 ([10.0.0.6] helo=frontend.clustermail.de) by smtpout-04.clustermail.de with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b5VXh-0007cZ-TP; Wed, 25 May 2016 11:56:24 +0200 Received: from [217.6.33.234] (helo=Win2012-02.gin-domain.local) by frontend.clustermail.de with esmtpsa (TLSv1.2:AES256-SHA:256) (Exim 4.84_2) (envelope-from ) id 1b5VXh-0004ID-Jw; Wed, 25 May 2016 11:55:57 +0200 Received: from Win2012-02.gin-domain.local (192.168.1.12) by Win2012-02.gin-domain.local (192.168.1.12) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Wed, 25 May 2016 11:55:56 +0200 Received: from Win2012-02.gin-domain.local ([fe80::3db4:55fd:d76e:9d90]) by Win2012-02.gin-domain.local ([fe80::3db4:55fd:d76e:9d90%12]) with mapi id 15.00.1130.005; Wed, 25 May 2016 11:55:56 +0200 From: "Klauer, Daniel" To: "Burton, Ross" Thread-Topic: [poky] [PATCH] smartpm: Don't ignore error if RPM transaction fails without problems Thread-Index: AQHRrCSIVtG7FGkbD0O1UJBF03zw/p+82SYAgAylCqE= Date: Wed, 25 May 2016 09:55:56 +0000 Message-ID: <1464170156000.4828@gin.de> References: <8759c4fa3b364ca6966f81155185b602@Win2012-02.gin-domain.local>, In-Reply-To: Accept-Language: en-US, de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [192.168.1.219] x-brightmail-tracker: H4sIAAAAAAAAC+NgFvrAqsTGxXJgBSOP7toy13CD+7db2rktevr7WCw2tK9lcmAKYIhizcxLyq9IYM24M3Ufe8HriopFX94yNTB+zuti5OQQEtjDKPHqtG4XIxeQfZJR4szCuywgCWYBU4krXxuhbEWJC/cawGw2AV2Jc+3vWUFsEQEtibOvHzND1BhL7Dj9E6xGWCBZYsnFLrYuRg6gmhSJm58jIcqtJNZdPMAEYksI6Ej8XdQINoZFQFXi9Z0LzCDlvALqEjP25kCc088ocffaBrCRnAKBEms3rAJbxSggK9HZ8I4JYq24xK0n86FmCkgs2XOeGcJWkui9/Q4qbiixav0KdhCbV0BQ4uTMJywQcTOJvQ+WQNXoSdw8tguqN1Di+4eXYPdIAIPh6vtgiLCBxLu1n6FajSVWbvzPCGHbSuyZMZEJotxZYt6Neoiwk8SbjresELa2xPZX+1hhPt90bRXLBEbNWUjhPAspnGcheWwWkqMXMLKsYpQOz8wzMjA00jUw0kvPzNNNyc9NzMzTy8lPTszZxAhNDTsYH312PcQoycGkJMp7UM81XIgvKT+lMiOxOCO+qDQntfgQowQHj5IIr1kJUI63uCAxtzgzHSYlw8GhJMHLCZISLEpNT61Iy8wpSS2CSJ9ilJQS580DSQqA9GWU5sHlLjGKSgnzuqUB5XgKUotyM0sg4rcYhTkeMgmx5OXnpUoBncgABBqMrxjFORiVhHkngcziycwrgTvhFdB1TEDX+X9xBrmuJBEhJdXAGPjFOnT3/M3u9Q7n9rvv1m2dyy15LFwwd2OGZu/lu/sfNHj9OL6fxd9Mr471Y8KZRN1t11/FzZtzdX2KVHdIljj/M9HJy1+pVH9jFLJhmXSvTKH7sfVGTuPozAL1kIraD3tKrjBXXvzmlXN08ga5Bg9nS4ZWD8fVglOenK5WmM60/S/Tli2CSizFGYmGWsxFxYkAxL037oMDAAA= MIME-Version: 1.0 Cc: "poky@yoctoproject.org" Subject: Re: [PATCH] smartpm: Don't ignore error if RPM transaction fails without problems X-BeenThere: poky@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Poky build system developer discussion & patch submission for meta-yocto List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 09:56:31 -0000 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_14641701560004828ginde_" --_000_14641701560004828ginde_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, thanks for the hint, I've sent this (and 2 more smartpm patches) to oe-core= . Best regards, Daniel ________________________________ From: Burton, Ross Sent: Tuesday, May 17, 2016 12:47 To: Klauer, Daniel Cc: poky@yoctoproject.org Subject: Re: [poky] [PATCH] smartpm: Don't ignore error if RPM transaction = fails without problems Good catch but patches that are actually for openembedded-core should go to= openembedded-core@lists.openembedded.org, can you resend it? Cheers, Ross On 12 May 2016 at 09:01, Klauer, Daniel > wrote: SmartPM could misinterpret RPM transaction error as success, if ts.run() (RPM Python API) returns an empty problems list. This could happen for example if the RPM database is partially corrupted such that the transaction does not have any problems like conflicts or missing dependencies, but still can't be committed. The added patch fixes the problem in the upstream sources; one of the existing patches has to be adjusted to still apply. Signed-off-by: Daniel Klauer > --- ...gnore-transaction-error-with-empty-proble.patch | 57 ++++++++++++++++++= ++++ .../python/python-smartpm/smart-attempt.patch | 6 +-- meta/recipes-devtools/python/python-smartpm_git.bb | 1 + 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 meta/recipes-devtools/python/python-smartpm/0001-rpm-Do= n-t-ignore-transaction-error-with-empty-proble.patch diff --git a/meta/recipes-devtools/python/python-smartpm/0001-rpm-Don-t-ign= ore-transaction-error-with-empty-proble.patch b/meta/recipes-devtools/pytho= n/python-smartpm/0001-rpm-Don-t-ignore-transaction-error-with-empty-proble.= patch new file mode 100644 index 0000000..a740ddd --- /dev/null +++ b/meta/recipes-devtools/python/python-smartpm/0001-rpm-Don-t-ignore-tra= nsaction-error-with-empty-proble.patch @@ -0,0 +1,57 @@ +From 0c55d7e18f40465e95e8e4bf22af01f5d4477d3c Mon Sep 17 00:00:00 2001 +From: Daniel Klauer > +Date: Wed, 11 May 2016 17:22:49 +0200 +Subject: [PATCH] rpm: Don't ignore transaction error with empty problems l= ist + +SmartPM could misinterpret RPM transaction error as success, +if ts.run() (RPM Python API) returns an empty problems list, +because of incorrect check for None which treated empty list +to be the same as None when it has different meaning. + +ts.run() returns: +* None in case of success +* problems list in case of error, may be empty +(look at rpmts_Run() in rpm-5.4.14/python/rpmts-py.c [1]) + +"if mylist" is not good enough to check for error here, because it will +treat an empty list as "false" because its len() =3D=3D 0 [2]. + +ts.check() seems to be different (it's ok for it to return an empty list), +but for consistency it should be made clear that it can return either None= , +an empty list or a non-empty list. + +[1] http://rpm5.org/cvs/fileview?f=3Drpm/python/rpmts-py.c&v=3D1.111.2.3 +[2] https://docs.python.org/2/library/stdtypes.html#truth-value-testing + +Upstream-Status: Pending + +Signed-off-by: Daniel Klauer > +--- + smart/backends/rpm/pm.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/smart/backends/rpm/pm.py b/smart/backends/rpm/pm.py +index 9bbd952..635f726 100644 +--- a/smart/backends/rpm/pm.py ++++ b/smart/backends/rpm/pm.py +@@ -208,7 +208,7 @@ class RPMPackageManager(PackageManager): + force =3D sysconf.get("rpm-force", False) + if not force: + probs =3D ts.check() +- if probs: ++ if (probs is not None) and (len(probs) !=3D 0): + problines =3D [] + for prob in probs: + name1 =3D "%s-%s-%s" % prob[0] +@@ -247,7 +247,7 @@ class RPMPackageManager(PackageManager): + del getTS.ts + cb.grabOutput(False) + prog.setDone() +- if probs: ++ if probs is not None: + raise Error, "\n".join([x[0] for x in probs]) + prog.stop() + +-- +1.9.1 + diff --git a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patc= h b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch index ec98e03..5aedc88 100644 --- a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch +++ b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch @@ -36,7 +36,7 @@ index 9bbd952..ba6405a 100644 finally: del getTS.ts cb.grabOutput(False) -+ if probs and sysconf.has("attempt-install", soft=3DTrue): ++ if (probs is not None) and sysconf.has("attempt-install", sof= t=3DTrue): + def remove_conflict(pkgNEVR): + for key in changeset.keys(): + if pkgNEVR =3D=3D str(key): @@ -67,8 +67,8 @@ index 9bbd952..ba6405a 100644 + retry =3D 0 + prog.setDone() -- if probs: -+ if probs and (not retry): +- if probs is not None: ++ if (probs is not None) and (not retry): raise Error, "\n".join([x[0] for x in probs]) prog.stop() + if retry and len(changeset): diff --git a/meta/recipes-devtools/python/python-smartpm_git.bb b/meta/recipes-devtools/python/python-smartpm_git.bb index d6c378b..95b7e09 100644 --- a/meta/recipes-devtools/python/python-smartpm_git.bb +++ b/meta/recipes-devtools/python/python-smartpm_git.bb @@ -17,6 +17,7 @@ SRC_URI =3D "\ file://smart-recommends.patch \ file://smart-improve-error-reporting.patch \ file://smart-channelsdir.patch \ + file://0001-rpm-Don-t-ignore-transaction-error-with-empty-proble= .patch \ file://smart-attempt.patch \ file://smart-attempt-fix.patch \ file://smart-rpm4-fixes.patch \ -- 1.9.1 -- _______________________________________________ poky mailing list poky@yoctoproject.org https://lists.yoctoproject.org/listinfo/poky --_000_14641701560004828ginde_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello,


thanks for the hint, I've sent this (and 2 more smartpm patches) to oe-c= ore.


Best regards,

Daniel



From: Burton, Ross <ro= ss.burton@intel.com>
Sent: Tuesday, May 17, 2016 12:47
To: Klauer, Daniel
Cc: poky@yoctoproject.org
Subject: Re: [poky] [PATCH] smartpm: Don't ignore error if RPM trans= action fails without problems
 
Good catch but patches that are actually for openembedded-= core should go to openembedded-co= re@lists.openembedded.org, can you resend it?

Cheers,
Ross

On 12 May 2016 at 09:01, Klauer, Daniel <Daniel.Klauer= @gin.de> wrote:
SmartPM could misinterpret RPM transaction error as success,
if ts.run() (RPM Python API) returns an empty problems list.

This could happen for example if the RPM database is partially corrupted such that the transaction does not have any problems like conflicts or
missing dependencies, but still can't be committed.

The added patch fixes the problem in the upstream sources;
one of the existing patches has to be adjusted to still apply.

Signed-off-by: Daniel Klauer <da= niel.klauer@gin.de>
---
 ...gnore-transaction-error-with-empty-proble.patch | 57 ++= 3;++++++++++++++= 3;++++
 .../python/python-smartpm/smart-attempt.patch      |&n= bsp; 6 +--
 meta/recipes-devtools/python/python-smartpm_git.bb |  1 &= #43;
 3 files changed, 61 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-devtools/python/python-smartpm/0001-r= pm-Don-t-ignore-transaction-error-with-empty-proble.patch

diff --git a/meta/recipes-devtools/python/python-smartpm/0001-rpm-Don-t-ign= ore-transaction-error-with-empty-proble.patch b/meta/recipes-devtools/pytho= n/python-smartpm/0001-rpm-Don-t-ignore-transaction-error-with-empty-proble.= patch
new file mode 100644
index 0000000..a740ddd
--- /dev/null
+++ b/meta/recipes-devtools/python/python-smartpm/0001-rpm-Don-= t-ignore-transaction-error-with-empty-proble.patch
@@ -0,0 +1,57 @@
+From 0c55d7e18f40465e95e8e4bf22af01f5d4477d3c Mon Sep 17 00:00:00 2001=
+From: Daniel Klauer <daniel= .klauer@gin.de>
+Date: Wed, 11 May 2016 17:22:49 +0200
+Subject: [PATCH] rpm: Don't ignore transaction error with empty proble= ms list
+
+SmartPM could misinterpret RPM transaction error as success,
+if ts.run() (RPM Python API) returns an empty problems list,
+because of incorrect check for None which treated empty list
+to be the same as None when it has different meaning.
+
+ts.run() returns:
+* None in case of success
+* problems list in case of error, may be empty
+(look at rpmts_Run() in rpm-5.4.14/python/rpmts-py.c [1])
+
+"if mylist" is not good enough to check for error here, beca= use it will
+treat an empty list as "false" because its len() =3D=3D 0 [2= ].
+
+ts.check() seems to be different (it's ok for it to return an empty li= st),
+but for consistency it should be made clear that it can return either = None,
+an empty list or a non-empty list.
+
+[1] http://rpm5.org/cvs/fileview?f=3Drpm/python/rpmts-py.c&v=3D1.111.2.3
+[2]
https://docs.python.org/2/library/stdtypes.html#truth-value-testing
+
+Upstream-Status: Pending
+
+Signed-off-by: Daniel Klauer <daniel.klauer@gin.de>
+---
+ smart/backends/rpm/pm.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/smart/backends/rpm/pm.py b/smart/backends/rpm/pm.py
+index 9bbd952..635f726 100644
+--- a/smart/backends/rpm/pm.py
++++ b/smart/backends/rpm/pm.py
+@@ -208,7 +208,7 @@ class RPMPackageManager(PackageManager):
+         force =3D sysconf.get("rpm-forc= e", False)
+         if not force:
+             probs =3D ts.check() +-            if probs:
++            if (probs is not None) = and (len(probs) !=3D 0):
+                 probline= s =3D []
+                 for prob= in probs:
+                    =  name1 =3D "%s-%s-%s" % prob[0]
+@@ -247,7 +247,7 @@ class RPMPackageManager(PackageManager):
+             del getTS.ts
+             cb.grabOutput(False) +             prog.setDone()
+-            if probs:
++            if probs is not None: +                 raise Er= ror, "\n".join([x[0] for x in probs])
+             prog.stop()
+
+--
+1.9.1
+
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patc= h b/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
index ec98e03..5aedc88 100644
--- a/meta/recipes-devtools/python/python-smartpm/smart-attempt.patch
+++ b/meta/recipes-devtools/python/python-smartpm/smart-attempt= .patch
@@ -36,7 +36,7 @@ index 9bbd952..ba6405a 100644
          finally:
              del getTS.ts
              cb.grabOutput(False)
-+            if probs and sysconf.has(&q= uot;attempt-install", soft=3DTrue):
++            if (probs is not None) = and sysconf.has("attempt-install", soft=3DTrue):
 +                def remo= ve_conflict(pkgNEVR):
 +                  &= nbsp; for key in changeset.keys():
 +                  &= nbsp;     if pkgNEVR =3D=3D str(key):
@@ -67,8 +67,8 @@ index 9bbd952..ba6405a 100644
 +                  &= nbsp;     retry =3D 0
 +
              prog.setDone()
--            if probs:
-+            if probs and (not retry): +-            if probs is not None:
++            if (probs is not None) = and (not retry):
                  raise Error,= "\n".join([x[0] for x in probs])
              prog.stop()
 +            if retry and len(chang= eset):
diff --git a/meta/recipes-devtools/python/python-smartpm_git.bb b/me= ta/recipes-devtools/python/python-smartpm_git.bb
index d6c378b..95b7e09 100644
--- a/meta/recipes-devtools/python/python-smartpm_git.bb
+++ b/meta/recipes-devtools/python/python-smartpm_git.bb=
@@ -17,6 +17,7 @@ SRC_URI =3D "\
           file://smart-recommends.patch \            file://smart-improve-error-reporti= ng.patch \
           file://smart-channelsdir.patch \ +          file://0001-rpm-Don-t-ignore-transa= ction-error-with-empty-proble.patch \
           file://smart-attempt.patch \
           file://smart-attempt-fix.patch \            file://smart-rpm4-fixes.patch \ --
1.9.1
--
_______________________________________________
poky mailing list
poky@yoctoproject.org
https://lists.yoctoproject.org/listinfo/poky

--_000_14641701560004828ginde_--