Bug 491077

Summary: yumUtils.oldUtils is broken
Product: Red Hat Enterprise Linux 5 Reporter: Daniel Mach <dmach>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: urgent Docs Contact:
Priority: high    
Version: 5.3CC: bperkins, ddumas, dgregor, jhutar, npetrov, rlerch
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Current versions of yum include code for old yum utilities. The continued availability of the old utilities allows developers to ensure backward compatibility of yum features with the versions of yum shipped with earlier versions of Red Hat Enterprise Linux. A number of errors in this code have been corrected, ensuring that tests against these old utilities remain valid.
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 03:33:12 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
a patch none

Description Daniel Mach 2009-03-19 06:46:34 EDT
yumUtils.oldUtils contains a lot of errors and is completely unusable.

I suggest to review the code and fix it.
I already fixed most annoying errors (see my patch).
Comment 1 Daniel Mach 2009-03-19 06:49:22 EDT
Created attachment 335830 [details]
a patch
Comment 2 Daniel Mach 2009-03-19 06:51:51 EDT
*** Bug 491069 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Mach 2009-03-19 06:52:07 EDT
*** Bug 491070 has been marked as a duplicate of this bug. ***
Comment 4 Daniel Mach 2009-03-19 06:52:17 EDT
*** Bug 491072 has been marked as a duplicate of this bug. ***
Comment 5 Daniel Mach 2009-03-19 06:52:30 EDT
*** Bug 491073 has been marked as a duplicate of this bug. ***
Comment 6 Daniel Mach 2009-03-19 06:52:42 EDT
*** Bug 491074 has been marked as a duplicate of this bug. ***
Comment 7 Daniel Mach 2009-03-19 06:52:55 EDT
*** Bug 491075 has been marked as a duplicate of this bug. ***
Comment 8 Daniel Mach 2009-03-19 06:54:38 EDT
Sorry for submitting so many duplicate bugs, Bugzilla refused to create a bug and ended with a proxy error. So I tried it several times.
Comment 9 James Antill 2009-03-25 02:13:16 EDT
What is using this? And the patch contains a lot of non-critical changes.
Comment 10 Daniel Mach 2009-03-25 04:18:22 EDT
We use it in release-engineering tools for compatibility with rhel4.
If you don't like the patch, just write another one.

I strongly suggest to use pylint to discover all issues in this module, I fixed those affecting our scripts.
Comment 11 James Antill 2009-03-25 09:19:28 EDT
 Ok, I did:

diff --git a/rpmUtils/oldUtils.py b/rpmUtils/oldUtils.py
index 1216ce4..5011e8f 100644
--- a/rpmUtils/oldUtils.py
+++ b/rpmUtils/oldUtils.py
@@ -6,7 +6,12 @@ import os
 import gzip
 import sys
 from gzip import write32u, FNAME
+from urlgrabber.grabber import URLGrabError
+from zlib import error as zlibError
 
+def log(num, msg):
+    print >>sys.stderr, msg
+errorlog = log
 
 def _(msg):
     return msg
@@ -168,6 +173,8 @@ def _gzipOpen(filename, mode="rb", compresslevel=9):
     return GzipFile(filename, mode, compresslevel)
 
 class RPM_Base_Work:
+    def __init__(self):
+        self.hdr = None
 
     def _getTag(self, tag):
         if self.hdr is None:

....which I hope is everything you wanted/needed. Why did you do this bit:

-        ts.setVSFlags(~(rpm._RPMVSF_NOSIGNATURES))
+        ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
Comment 12 Daniel Mach 2009-03-25 09:36:16 EDT
> -        ts.setVSFlags(~(rpm._RPMVSF_NOSIGNATURES))
> +        ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) 

If I recall it right, it throws an exception when a rpm is not signed.
But we need get headers even for unsigned rpms.
Comment 14 Denise Dumas 2009-05-20 15:57:32 EDT
Most of Daniel's patch is in so I'm putting this in Modified.  See comment 10 for details.
Comment 17 Jan Hutaƙ 2009-06-10 05:29:45 EDT
Hello, is the current state (yum-3.2.22-14.el5.noarch) OK for you -> VERIFIED or FAILS_QA?
Comment 18 Daniel Mach 2009-06-22 11:47:10 EDT
I think you can move it to VERIFIED.
Latest code looks fine, pylint does not find any errors.
Comment 21 Ruediger Landmann 2009-09-01 14:53:32 EDT
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
Current versions of yum include code for old yum utilities. The continued availability of the old utilities allows developers to ensure backward compatibility of yum features with the versions of yum shipped with earlier versions of Red Hat Enterprise Linux. A number of errors in this code have been corrected, ensuring that tests against these old utilities remain valid.
Comment 22 errata-xmlrpc 2009-09-02 03:33:12 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-1419.html