diff --git a/README.rst b/README.rst index 80f173f..003fa67 100644 --- a/README.rst +++ b/README.rst @@ -44,6 +44,8 @@ Change Log * bugfix: when using -q, don't hide warnings about files that can't be statted or read +* bugfix: -s is no longer broken on Python 3 + 0.9.0 ~~~~~ diff --git a/src/bitrot.py b/src/bitrot.py index 2204f54..80c8b91 100644 --- a/src/bitrot.py +++ b/src/bitrot.py @@ -42,7 +42,7 @@ import time DEFAULT_CHUNK_SIZE = 16384 DOT_THRESHOLD = 200 -VERSION = (0, 9, 0) +VERSION = (0, 9, 1) IGNORED_FILE_SYSTEM_ERRORS = {errno.ENOENT, errno.EACCES} FSENCODING = sys.getfilesystemencoding() @@ -382,18 +382,20 @@ def get_path(directory=b'.', ext=b'db'): return os.path.join(directory, b'.bitrot.' + ext) -def stable_sum(bitrot_db): +def stable_sum(bitrot_db=None): """Calculates a stable SHA512 of all entries in the database. Useful for comparing if two directories hold the same data, as it ignores timing information.""" + if bitrot_db is None: + bitrot_db = get_path() digest = hashlib.sha512() conn = get_sqlite3_cursor(bitrot_db) cur = conn.cursor() cur.execute('SELECT hash FROM bitrot ORDER BY path') row = cur.fetchone() while row: - digest.update(row[0]) + digest.update(row[0].encode('ascii')) row = cur.fetchone() return digest.hexdigest()