[mirrorbrain-commits] r8259 - /trunk/mb/mb/hashes.py

From: <poeml_at_mirrorbrain.org>
Date: Fri, 23 Mar 2012 23:53:28 -0000
Author: poeml
Date: Sat Mar 24 00:53:28 2012
New Revision: 8259

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8259&view=rev
Log:
mb makehashes:
- ignore signature (.asc) files that are larger than the file that they sign. This happens when 
  a signature is not detached. It can lead to problems when the signature is
  very large, or contains badly encoded characters. Thanks Tom Albers for bringing this up!

Modified:
    trunk/mb/mb/hashes.py

Modified: trunk/mb/mb/hashes.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/hashes.py?rev=8259&r1=8258&r2=8259&view=diff
==============================================================================
--- trunk/mb/mb/hashes.py	(original)
+++ trunk/mb/mb/hashes.py	Sat Mar 24 00:53:28 2012
_at_@ -308,7 +308,12 @@
             self.calc_btih()
 
         # if present, grab PGP signature
-        if os.path.exists(self.src + '.asc'):
+        # but not if the signature file is larger than 
+        # the actual file -- that would be a sign that the signature
+        # is not "detached", and could be huge (or contain characters that
+        # can not easily saved to the database for encoding reasons) 
+        if os.path.exists(self.src + '.asc') \
+            and os.stat(self.src + '.asc').st_size < self.h.size:
             self.pgp = open(self.src + '.asc').read()
 
         #print len(self.zsums)




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Fri Mar 23 2012 - 23:53:32 GMT

This archive was generated by hypermail 2.3.0 : Sat Mar 24 2012 - 00:17:02 GMT