Fix verify output range merge bug (disk block unaligned pieces) master
authorJakob Cornell <jakob+gpg@jcornell.net>
Sun, 21 Aug 2022 15:31:39 +0000 (10:31 -0500)
committerJakob Cornell <jakob+gpg@jcornell.net>
Sun, 21 Aug 2022 15:31:39 +0000 (10:31 -0500)
disk_jumble/src/disk_jumble/verify.py

index 19cf1a75a771b837d6161e3dd40823235164fc57..5229f516150d850fa10ce9a6f7e1c51e368e606c 100644 (file)
@@ -359,7 +359,9 @@ def _do_verify(
        def clean_up(ranges):
                out = []
                for r in sorted(ranges, key = lambda r: r.start):
-                       if out and r.start == out[-1].stop:
+                       if out:
+                               assert r.start >= out[-1].stop - 1
+                       if out and r.start <= out[-1].stop:
                                out[-1] = range(out[-1].start, r.stop)
                        else:
                                out.append(r)