Bug 655207 - update-packages fails when a package is corrupt but does not say which package it is
Summary: update-packages fails when a package is corrupt but does not say which packag...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Installer
Version: 540
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Milan Zázrivec
QA Contact: Šimon Lukašík
URL:
Whiteboard:
Depends On:
Blocks: sat54-errata
TreeView+ depends on / blocked
 
Reported: 2010-11-19 21:10 UTC by Guil Barros
Modified: 2018-10-27 11:24 UTC (History)
4 users (show)

Fixed In Version: spacewalk-backend-1.2.13-23
Doc Type: Bug Fix
Doc Text:
Cause: When processing a corrupted package, update-packages script did not inform which specific package was corrupted. Consequence: In the problematic situations, it wasn't obvious which package is corrupted. Fix: the fix was quite easy and non-invasive. Result: update-packages now correctly informs of corrupted packages.
Clone Of:
Environment:
Last Closed: 2011-02-01 16:16:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0190 0 normal SHIPPED_LIVE Red Hat Network Satellite bug fix update 2011-02-01 16:15:56 UTC

Description Guil Barros 2010-11-19 21:10:06 UTC
Description of problem:
update-packages fails when a package is corrupt but does not say which package it is:

# /usr/bin/update-packages --db=$(spacewalk-cfg-get default_db) --debug
--update-filer
Connecting to rhnsat/rhnsat@rhnsat
         ________________________________________
standby: error: rpmts_HdrFromFdno: MD5 digest: BAD
Expected(ab1074787b4566efbf4500818718e728) !=
(8ea603b30640e7da5b2e90e9e27abddd)
Traceback (most recent call last):
  File "/usr/bin/update-packages", line 102, in ?
    sys.exit(abs(main() or 0))
  File "/usr/bin/update-packages", line 92, in main
    return updatePackages.main()
  File "/usr/share/rhn/satellite_tools/updatePackages.py", line 82, in
main
    process_package_data()
  File "/usr/share/rhn/satellite_tools/updatePackages.py", line 184, in
process_package_data
    hdr = rhn_rpm.get_package_header(filename=old_abs_path)
  File "/usr/lib/python2.4/site-packages/spacewalk/common/rhn_rpm.py",
line 276, in get_package_header
    hdr = ts.hdrFromFdno(file_desc)
  File "/usr/lib/python2.4/site-packages/spacewalk/common/rhn_rpm.py",
line 110, in hdrFromFdno
    return self.ts.hdrFromFdno(fd)
_rpm.error: error reading package header


Version-Release number of selected component (if applicable):
RHN Satellite 5.4
spacewalk-backend-tools-1.2.13-11.el5sat

How reproducible:
Every time.

Steps to Reproduce:
1. Have a corrupt rpm in /var/satellite
2. Upgrade sat (run update-packages)
  
Actual results:
Fails and does not indicate corrupt package

Expected results:
Fail and indicate which package it failed on.

Comment 1 Guil Barros 2010-11-19 21:15:50 UTC
# diff -u updatePackages.py.SAVE updatePackages.py
--- updatePackages.py.SAVE      2010-11-19 14:34:17.000000000 -0600
+++ updatePackages.py   2010-11-19 14:44:39.000000000 -0600
@@ -183,6 +183,7 @@
         try:
             hdr = rhn_rpm.get_package_header(filename=old_abs_path)
         except:
+            print "error = %s" %(old_abs_path)
             rhnSQL.commit()
             raise

Comment 3 Milan Zázrivec 2010-12-07 15:40:45 UTC
spacewalk.git master: 99485b395298838990eae61ec61f61092ac32b29

Comment 4 Miroslav Suchý 2010-12-16 17:27:45 UTC
cherrypicked to satellite-git as commit 389351b35422ddc875e2c9e32ea3a536d15ce3a9

Comment 5 Šimon Lukašík 2011-01-03 12:20:45 UTC
Flipping back to Assigned:

I've finally managed to get the traceback from comment 0. Although
I cannot see the fix. Could you please look at the issue?


.RHN_NOT_LINK.[07:14:42][root@hp-xw9400-02 NULL]# /usr/bin/update-packages --db=$(spacewalk-cfg-get default_db) \
>         --update-filer \
>         --update-kstrees \
>         --debug
Connecting to rhnsat/rhnsat@rhnsat
         ________________________________________
standby: ####Traceback (most recent call last):
  File "/usr/bin/update-packages", line 102, in ?
    sys.exit(abs(main() or 0))
  File "/usr/bin/update-packages", line 92, in main
    return updatePackages.main()
  File "/usr/share/rhn/satellite_tools/updatePackages.py", line 85, in main
    process_package_data()
  File "/usr/share/rhn/satellite_tools/updatePackages.py", line 190, in process_package_data
    hdr = rhn_rpm.get_package_header(filename=old_abs_path)
  File "/usr/lib/python2.4/site-packages/spacewalk/common/rhn_rpm.py", line 276, in get_package_header
    hdr = ts.hdrFromFdno(file_desc)
  File "/usr/lib/python2.4/site-packages/spacewalk/common/rhn_rpm.py", line 110, in hdrFromFdno
    return self.ts.hdrFromFdno(fd)
_rpm.error: error reading package header
.RHN_NOT_LINK.1:[07:14:58][root@hp-xw9400-02 NULL]# rpm -q spacewalk-backend-tools
spacewalk-backend-tools-1.2.13-22.el5sat

Comment 7 Milan Zázrivec 2011-01-03 15:47:23 UTC
The original patch would put an information about the problematic
package into the log file and leave the traceback you're seeing so as it is,
so what you're describing in comment #5 is expected.

Although I agree that we could be printing this information into stdout
as well:

spacewalk.git master:
8253a75b97c3fae372d39ac86b93bc1166e163e6
253bab4bfd72c3674eb438468a14df0226cf11b2

satellite.git SATELLITE-5.4:
96e83eb3c1f54e1c66e437ef0271cf6c4c7cb042
603a85bbdb5669d27752b5a5a00c273597043195

Comment 10 Šimon Lukašík 2011-01-04 07:44:25 UTC
Changing to Verified:

Testing procedure:
 - upgrade satellite 520 to 540
 - (apply available errata right after the install phase)
 - then up to the comment 0.

Verified against:
spacewalk-backend-tools-1.2.13-23.el5sat


Thanks for the fix!

Comment 11 Florian Nadge 2011-01-27 11:27:56 UTC
Please be so kind and add a few key words to the Technical Note field of this
bugzilla entry using the following structure:

Cause:

Consequence:

Fix:

Result:


For details, see:
https://bugzilla.redhat.com/page.cgi?id=fields.html#cf_release_notes

Thanks

Comment 12 Florian Nadge 2011-01-27 11:27:57 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:

Consequence:

Fix:

Result:

Comment 13 Milan Zázrivec 2011-01-27 12:26:08 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,7 +1,7 @@
-Cause:
+Cause: When processing a corrupted package, update-packages script did not inform which specific package was corrupted.
 
-Consequence:
+Consequence: In the problematic situations, it wasn't obvious which package is corrupted.
 
-Fix:
+Fix: the fix was quite easy and non-invasive.
 
-Result:+Result: update-packages now correctly informs of corrupted packages.

Comment 14 Florian Nadge 2011-02-01 13:50:54 UTC
Milan, many thanks for the excellent CCFR.

Comment 15 errata-xmlrpc 2011-02-01 16:16:42 UTC
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-2011-0190.html


Note You need to log in before you can comment on or make changes to this bug.