Bug 1148163
| Summary: | checksum verification in spacewalk-data-fsck does not work | |||
|---|---|---|---|---|
| Product: | [Community] Spacewalk | Reporter: | Stephan Dühr <stephan.duehr> | |
| Component: | Server | Assignee: | Michael Mráka <mmraka> | |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Red Hat Satellite QA List <satqe-list> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 2.2 | CC: | cperry, fabiano.martins, pstudeni | |
| Target Milestone: | --- | |||
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | spacewalk-backend-2.3.18-1 | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1148439 (view as bug list) | Environment: | ||
| Last Closed: | 2015-04-14 19:03:35 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1207293 | |||
Need to change /usr/bin/spacewalk-data-fsck for debug
@@ -218,7 +218,7 @@
h.update(fp.read())
file_checksum = h.hexdigest()
fp.close()
- except:
+ except IndexError:
file_checksum = None
ret = 0
if file_checksum != checksum:
I get following traceback:
>> spacewalk-data-fsck
Traceback (most recent call last):
File "/usr/bin/spacewalk-data-fsck", line 312, in <module>
exit_value += check_db_vs_disk(options)
File "/usr/bin/spacewalk-data-fsck", line 109, in check_db_vs_disk
row['checksum_type'], row['checksum'])
File "/usr/bin/spacewalk-data-fsck", line 217, in check_disk_checksum
h = checksum.getHashlibInstance(checksum_type, False)
AttributeError: 'str' object has no attribute 'getHashlibInstance'
package: spacewalk-backend-tools-2.3.3-10.el6sat.noarch
Fixed in spacewalk master by
commit 34025800df02297be963b9dade036cda20b498d2
1148163 - fixed variable name
Moving bugs to ON_QA as we move to release Spacewalk 2.3 Spacewalk 2.3 has been released. See https://fedorahosted.org/spacewalk/wiki/ReleaseNotes23 |
Description of problem: spacewalk-data-fsck checksum verification is broken [root@spacew1 ~]# /usr/bin/spacewalk-data-fsck --db-only File checksum mismatch: /var/satellite/redhat/1/360/libjpeg/6b-46.el6/i686/36099439b7dbc9323588f1999bff9b1738bb8b4df56149eb7ebb5b5226107665/libjpeg-6b-46.el6.i686.rpm (sha256: 36099439b7dbc9323588f1999bff9b1738bb8b4df56149eb7ebb5b5226107665 vs. None) ... I'm getting "... vs. None)" for all files. Version-Release number of selected component (if applicable): spacewalk-backend-tools-2.2.43-1.el6.noarch How reproducible: Steps to Reproduce: 1. /usr/bin/spacewalk-data-fsck --db-only same for --fs-only 2. 3. Actual results: see above Expected results: checksum verification should work Additional info: The problem is that check_disk_checksum() is using "checksum" as a variable name, that overrides the import checksum: ... from spacewalk.common import checksum ... def check_disk_checksum(abs_path, checksum_type, checksum): try: fp = file(abs_path ,'rb') h = checksum.getHashlibInstance(checksum_type, False) h.update(fp.read()) file_checksum = h.hexdigest() fp.close() except: file_checksum = None ret = 0 if file_checksum != checksum: log(0, "File checksum mismatch: %s (%s: %s vs. %s)" % (abs_path, checksum_type, checksum, file_checksum)) ret = 1 return ret When adding raise to see the exception, it is: ... File "/usr/bin/spacewalk-data-fsck_debug", line 217, in check_disk_checksum h = checksum.getHashlibInstance(checksum_type, False) AttributeError: 'str' object has no attribute 'getHashlibInstance' possible patch: --- spacewalk-data-fsck.orig 2014-07-11 13:57:05.000000000 +0200 +++ spacewalk-data-fsck 2014-09-30 21:49:00.487999668 +0200 @@ -211,7 +211,7 @@ log(0, "File %s%s successfully restored, new file path: %s" % (prefix, row['path'], new_path)) return 0 -def check_disk_checksum(abs_path, checksum_type, checksum): +def check_disk_checksum(abs_path, checksum_type, db_checksum): try: fp = file(abs_path ,'rb') h = checksum.getHashlibInstance(checksum_type, False) @@ -221,9 +221,9 @@ except: file_checksum = None ret = 0 - if file_checksum != checksum: + if file_checksum != db_checksum: log(0, "File checksum mismatch: %s (%s: %s vs. %s)" % - (abs_path, checksum_type, checksum, file_checksum)) + (abs_path, checksum_type, db_checksum, file_checksum)) ret = 1 return ret Probably the following commit broke it: https://github.com/spacewalkproject/spacewalk/commit/5dabeddf4306f61f555b6a329324dbc3b0afc8cc