From 227b804c7a112e30cf1fdff09d6629d71fcb49e1 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 1 Jul 2024 13:11:45 -0500 Subject: [PATCH] Fixed dbgbmap.py missing btree nodes The internal btree node traversal here is a bit different than in dbgbtree.py, dbgmtree.py, etc, because we want to include both inner and leaf nodes. We could decode the branch tags multiple times, but checking for bid changes is a bit simpler. It's interesting to note this went missed for so long, because, well, it's hard to actually have more than one btree node. And the tests explicitly covering large btree structures, test_btree, aren't parsable by dbgbmap.py since they don't create real filesystem images. --- scripts/dbgbmap.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index cc5ac893..dbff6281 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -1169,7 +1169,10 @@ def main(disk, mroots=None, *, enumerate(ppath)): if x is None: break - if not (changed or px is None or x[0] != px[0]): + if not (changed + or px is None + # bid-rid changed? + or (x[1][0]-x[1][3]) != (px[1][0]-px[1][3])): continue changed = True @@ -1272,12 +1275,15 @@ def main(disk, mroots=None, *, enumerate(ppath)): if x is None: break - if not (changed or px is None or x[0] != px[0]): + if not (changed + or px is None + # bid-rid changed? + or (x[1][0]-x[1][3]) != (px[1][0]-px[1][3])): continue changed = True # mark btree inner nodes in our bmap - d, (mid_, w_, rbyd_, rid_, tags_) = x + d, (bid_, w_, rbyd_, rid_, tags_) = x # ignore bshrub roots if shrub and d == 0: continue