[PATCH 1/1] validate-refs: fix expected split tree bupm entry count

0 views
Skip to first unread message

Rob Browning

unread,
Jul 7, 2026, 5:17:50 PM (9 days ago) Jul 7
to bup-...@googlegroups.com
Returning 2 just appears to be a mistake. Fix it, and describe the
split tree handling of bupm files a bit in the existing DESIGN
section.

The tests didn't catch it because I'd forgotten to enable split trees
in the test repo.

Thanks to Johannes Berg for verification.

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---

Pushed to main.

DESIGN.md | 7 +++++++
lib/bup/cmd/validate_refs.py | 2 +-
test/ext/test-validate-refs | 13 +++++++------
3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/DESIGN.md b/DESIGN.md
index d1bd3561..872a8858 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -461,6 +461,13 @@ to left), and will never contain `..`. This allows future extensions,
e.g. `PREFIX..SOMETHING_NEW_WITHOUT_DOTS.3.bupd`. The `DEPTH` will
always be a sequence of `[0-9]+`.

+The top-level in a split tree contains a `.bupm` file that has a
+single entry for the original directory. The intermediate levels have
+no `.bupm`, and the leaves contain `.bupm` files with entries for
+their respective contents. In the leaf `.bupm` files, the first
+metadata entry, which would normally be for the directory itself, is
+empty.
+
Detailed Metadata
-----------------

diff --git a/lib/bup/cmd/validate_refs.py b/lib/bup/cmd/validate_refs.py
index 2b31f25c..85f53365 100644
--- a/lib/bup/cmd/validate_refs.py
+++ b/lib/bup/cmd/validate_refs.py
@@ -26,7 +26,7 @@ def expected_bup_entry_count_for_tree(tree_data):
exp_n = 1 # for the parent dir
for mode, mangled_name, oid_ in tree_iter(tree_data):
if mangled_name.endswith(b'.bupd'):
- return 2
+ return 1
if mangled_name == b'.bupm':
continue
kind = demangle_name(mangled_name, mode)[1]
diff --git a/test/ext/test-validate-refs b/test/ext/test-validate-refs
index 897b76a1..11980c32 100755
--- a/test/ext/test-validate-refs
+++ b/test/ext/test-validate-refs
@@ -21,18 +21,19 @@ WVPASS cd "$tmpdir"
WVSTART 'handling of correct refs'
WVPASS rm -rf bup src
WVPASS bup init
+WVPASS git config bup.split.trees true
WVPASS mkdir src
WVPASS mkdir -p src/a/b
WVPASS touch src/a/{1,2,3}
WVPASS "$top/dev/make-splittable-tree" src/split-tree
WVPASS bup index src
WVPASS bup save --strip -n src src
-WVPASS bup validate-refs --links 2>&1 | tee validate.log
-WVPASS grep -vE '^missing ' validate.log
-WVPASS bup validate-refs --bupm 2>&1 | tee validate.log
-WVPASS grep -vE '^missing ' validate.log
-WVPASS bup validate-refs 2>&1 | tee validate.log
-WVPASS grep -vE '^missing ' validate.log
+WVPASS err-to log bup validate-refs --links
+WVPASS test "$(du log | cut -f1)" -eq 0
+WVPASS err-to log bup validate-refs --bupm
+WVPASS test "$(du log | cut -f1)" -eq 0
+WVPASS err-to log bup validate-refs
+WVPASS test "$(du log | cut -f1)" -eq 0
WVPASS rm -rf src bup

WVSTART 'detection of abridged bupms'
--
2.47.3

Reply all
Reply to author
Forward
0 new messages