From 8666830515ba8ac495473c8584eba1b20ae012e0 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 28 Jul 2025 01:26:33 -0500 Subject: [PATCH] bmap: scripts: Fixed missing geometry race condition The gbmap's weight is defined by the block count stored in the geometry config field, which should always be present in valid littlefs3 images. But our scripts routinely try to parse _invalid_ littlefs3 images when running in parallel with benchmarks/tests (littlefs3 does _not_ support multiple read/writers), so this was causing exceptions to be thrown. The fix is to just assume weight=0 when the geometry field is missing. The image isn't valid, and the gbmap is optional anyways. --- scripts/dbgbmap.py | 3 ++- scripts/dbgbmapsvg.py | 3 ++- scripts/dbglfs3.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index 633b2e4e..ad444290 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -2778,7 +2778,8 @@ class Gstate: block, trunk, cksum, d_ = frombranch(self.data, d); d += d_ self.btree = Btree.fetchck( mtree.bd, block, trunk, - config.geometry.block_count, + config.geometry.block_count + if config.geometry is not None else 0, cksum) def repr(self): diff --git a/scripts/dbgbmapsvg.py b/scripts/dbgbmapsvg.py index 3e522454..5aafc017 100755 --- a/scripts/dbgbmapsvg.py +++ b/scripts/dbgbmapsvg.py @@ -2808,7 +2808,8 @@ class Gstate: block, trunk, cksum, d_ = frombranch(self.data, d); d += d_ self.btree = Btree.fetchck( mtree.bd, block, trunk, - config.geometry.block_count, + config.geometry.block_count + if config.geometry is not None else 0, cksum) def repr(self): diff --git a/scripts/dbglfs3.py b/scripts/dbglfs3.py index 5af36289..055a4609 100755 --- a/scripts/dbglfs3.py +++ b/scripts/dbglfs3.py @@ -2735,7 +2735,8 @@ class Gstate: block, trunk, cksum, d_ = frombranch(self.data, d); d += d_ self.btree = Btree.fetchck( mtree.bd, block, trunk, - config.geometry.block_count, + config.geometry.block_count + if config.geometry is not None else 0, cksum) def repr(self):