From 62de8651036046379396cf5f72330a6cf991d276 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 20 Mar 2024 13:31:16 -0500 Subject: [PATCH] Eliminated null tag reachability in dbg scripts This was throwing off tree rendering in dbglfs.py, we attempt to lookup the null tag because we just want to first tag in the tree to stitch things together. Null tag reachability is tricky! You only notice if the tree happens to create a hole, which isn't that common. I think all lookup implementations should have this max(tag, 1) pattern from now on to avoid this. Note that most dbg scripts wouldn't run into this because we usually use the traversal tag+1 pattern. Still, the inconsistency in impl between the dbg scripts and lfs.c is bad. --- scripts/dbgbmap.py | 1 + scripts/dbgbtree.py | 1 + scripts/dbglfs.py | 1 + scripts/dbgmtree.py | 1 + scripts/dbgrbyd.py | 1 + 5 files changed, 5 insertions(+) diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index 91474f31..933b1e15 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -715,6 +715,7 @@ class Rbyd: if not self: return True, 0, -1, 0, 0, 0, b'', [] + tag = max(tag, 0x1) lower = 0 upper = self.weight path = [] diff --git a/scripts/dbgbtree.py b/scripts/dbgbtree.py index 0a901dbb..bcc498a6 100755 --- a/scripts/dbgbtree.py +++ b/scripts/dbgbtree.py @@ -375,6 +375,7 @@ class Rbyd: if not self: return True, 0, -1, 0, 0, 0, b'', [] + tag = max(tag, 0x1) lower = 0 upper = self.weight path = [] diff --git a/scripts/dbglfs.py b/scripts/dbglfs.py index 721eacab..cd4f2cc0 100755 --- a/scripts/dbglfs.py +++ b/scripts/dbglfs.py @@ -406,6 +406,7 @@ class Rbyd: if not self: return True, 0, -1, 0, 0, 0, b'', [] + tag = max(tag, 0x1) lower = 0 upper = self.weight path = [] diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index 807ed6c6..07ab0dd9 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -390,6 +390,7 @@ class Rbyd: if not self: return True, 0, -1, 0, 0, 0, b'', [] + tag = max(tag, 0x1) lower = 0 upper = self.weight path = [] diff --git a/scripts/dbgrbyd.py b/scripts/dbgrbyd.py index 50beb0b4..46d03ebb 100755 --- a/scripts/dbgrbyd.py +++ b/scripts/dbgrbyd.py @@ -614,6 +614,7 @@ def dbg_tree(data, block_size, rev, trunk, weight, *, # lookup a tag, returning also the search path for decoration # purposes def lookup(rid, tag): + tag = max(tag, 0x1) lower = 0 upper = weight path = []