Show warnings about unreadable files even with verbosity == 0

I had a semi-corrupt encfs (which I detected, thanks to this tool!). A
file was only partially readable. Somewhere in the middle, an IOError
occured. Essentially, this is a corrupt file system -- which this tool
is meant to help detect --, so this class of errors shouldn't be
suppressed by "-q".
This commit is contained in:
Peter Hofmann 2016-09-21 17:40:42 +02:00
parent 4e3c840eb0
commit 313347dd61

View File

@ -221,13 +221,12 @@ class Bitrot(object):
try: try:
new_sha1 = sha1(p, self.chunk_size) new_sha1 = sha1(p, self.chunk_size)
except (IOError, OSError) as e: except (IOError, OSError) as e:
if self.verbosity: print(
print( '\rwarning: cannot compute hash of {} [{}]'.format(
'\rwarning: cannot compute hash of {} [{}]'.format( p, errno.errorcode[e.args[0]],
p, errno.errorcode[e.args[0]], ),
), file=sys.stderr,
file=sys.stderr, )
)
continue continue
cur.execute('SELECT mtime, hash, timestamp FROM bitrot WHERE ' cur.execute('SELECT mtime, hash, timestamp FROM bitrot WHERE '