Issue85

Title mb makehashes doesn't work with very old Python
Priority bug Status resolved
Superseder Nosy List poeml
Assigned To poeml Keywords

Created on 2011-03-02.20:25:22 by poeml, last changed by poeml.

Messages
msg348 (view) Author: poeml Date: 2012-02-20.23:59:57
In 2.16.0.
msg328 (view) Author: poeml Date: 2011-03-02.20:27:40
proposed fix in trunk:

http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=8240
msg327 (view) Author: poeml Date: 2011-03-02.20:25:55
backtrace was:


  File "/usr/bin/mb", line 1638, in ?
    r = mirrordoctor.main()
  File "/usr/lib64/python2.4/site-packages/cmdln.py", line 257, in main
    return self.cmd(args)
  File "/usr/lib64/python2.4/site-packages/cmdln.py", line 280, in cmd
    retval = self.onecmd(argv)
  File "/usr/lib64/python2.4/site-packages/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/usr/lib64/python2.4/site-packages/cmdln.py", line 1100, in 
_dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/usr/bin/mb", line 1101, in do_makehashes
    copy_permissions=opts.copy_permissions)
  File "/usr/lib64/python2.4/site-packages/mb/hashes.py", line 90, in check_file
    self.hb.fill(verbose=verbose)
  File "/usr/lib64/python2.4/site-packages/mb/hashes.py", line 311, in fill
    self.calc_btih()
  File "/usr/lib64/python2.4/site-packages/mb/hashes.py", line 462, in calc_btih
    h.update(''.join(buf))
TypeError: sequence item 28: expected string, NoneType found
msg326 (view) Author: poeml Date: 2011-03-02.20:25:21
mb makehashes fails on SUSE SLES10, where SHA256 is not available. 


The following patch should fix this:


Index: mb/mb/hashes.py
===================================================================
--- mb/mb/hashes.py	(revision 8239)
+++ mb/mb/hashes.py	(working copy)
@@ -455,7 +455,7 @@
                  '12:piece length', 'i', str(self.chunk_size), 'e',
                  '6:pieces', str(len(self.pieces) * SHA1_DIGESTSIZE), ':', 
''.join(self.pieces),
                  '4:sha1', str(SHA1_DIGESTSIZE), ':', self.sha1,
-                 '6:sha256', str(SHA256_DIGESTSIZE), ':', self.sha256,
+                 '6:sha256', str(SHA256_DIGESTSIZE), ':', self.sha256 or '',
                'e']
 
         h = sha1.sha1()
History
Date User Action Args
2012-02-20 23:59:57poemlsetstatus: testing -> resolved
messages: + msg348
2011-03-02 20:27:40poemlsetmessages: + msg328
2011-03-02 20:25:55poemlsetmessages: + msg327
2011-03-02 20:25:22poemlcreate