[PATCH 1/3] test-split-files-config: adjust bupm exclusions

0 views
Skip to first unread message

Rob Browning

unread,
Nov 19, 2025, 5:27:15 PM (3 days ago) Nov 19
to bup-...@googlegroups.com
Fix the regular expression that excludes bupm files (split and
unsplit). This was occasionally causing the two related tests to fail
when a .bupm was split. Thanks to Johannes Berg for identifying the
problem.

cf. bff79f99107e741096ba016488329eb5f671ca53

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

Pushed to main.

test/ext/test-split-files-config | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/ext/test-split-files-config b/test/ext/test-split-files-config
index 5b9453e6..ab89a184 100755
--- a/test/ext/test-split-files-config
+++ b/test/ext/test-split-files-config
@@ -103,7 +103,7 @@ WVPASS git config -f "$BUP_DIR/config" bup.split.files legacy:13
WVPASS bup index "$top/test/testfile1" "$top/test/testfile3"
WVPASS bup save -n save "$top/test"
WVPASS git --git-dir bup ls-tree -r save \
- | WVPASS grep -vE '\.bupm(\.bup/.*)?$' \
+ | WVPASS grep -vE $'(\t|/)\.bupm(/|$)' \
| WVPASS cut -f1 \
| WVPASS cut -d' ' -f3 > oids
WVPASS cat > oids-exp <<EOF
@@ -155,7 +155,7 @@ WVPASS git config -f "$BUP_DIR/config" bup.split.files legacy:16
WVPASS bup index "$top/test/testfile1" "$top/test/testfile3"
WVPASS bup save -n save "$top/test"
WVPASS git --git-dir bup ls-tree -r save \
- | WVPASS grep -vE '\.bupm(\.bup/.*)?$' \
+ | WVPASS grep -vE $'(\t|/)\.bupm(/|$)' \
| WVPASS cut -f1 \
| WVPASS cut -d' ' -f3 > oids
WVPASS cat > oids-exp <<EOF
--
2.47.3

Rob Browning

unread,
Nov 19, 2025, 5:27:16 PM (3 days ago) Nov 19
to bup-...@googlegroups.com
Particularly since we already have a temp dir, just write the --log-fd
output to a file via --log-file instead. This avoids the need for the
preexec_fn redirections or the custom exo. It also revealed a
test-duplicity-import error on FreeBSD in CI that was not visible with
the previous arrangement.

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

Pushed to main.

lib/bup/cmd/import_duplicity.py | 41 +++++++++++----------------------
1 file changed, 14 insertions(+), 27 deletions(-)

diff --git a/lib/bup/cmd/import_duplicity.py b/lib/bup/cmd/import_duplicity.py
index 84060699..27de66b2 100644
--- a/lib/bup/cmd/import_duplicity.py
+++ b/lib/bup/cmd/import_duplicity.py
@@ -2,9 +2,9 @@
from calendar import timegm
from subprocess import check_call
from time import strptime
-import os, sys, tempfile
+import sys, tempfile

-from bup import git, helpers, options
+from bup import git, options
from bup.compat import argv_bytes
from bup.helpers import log, shstr
import bup.path
@@ -21,22 +21,10 @@ dry_run = False
def logcmd(cmd):
log(shstr(cmd).decode(errors='backslashreplace') + '\n')

-def exc(cmd, shell=False):
+def exc(cmd):
logcmd(cmd)
if not dry_run:
- check_call(cmd, shell=shell)
-
-def exo(cmd, shell=False, preexec_fn=None, close_fds=True):
- logcmd(cmd)
- if dry_run:
- return b''
- return helpers.exo(cmd, shell=shell, preexec_fn=preexec_fn,
- close_fds=close_fds)[0]
-
-def redirect_dup_output():
- os.dup2(1, 3)
- os.dup2(1, 2)
-
+ check_call(cmd)

def main(argv):
global dry_run
@@ -66,21 +54,20 @@ def main(argv):
dup = [b'duplicity', b'--archive-dir', tmpdir + b'/dup-cache']
restoredir = tmpdir + b'/restore'
tmpidx = tmpdir + b'/index'
-
- collection_status = \
- exo(dup + [b'collection-status', b'--log-fd=3', source_url],
- close_fds=False, preexec_fn=redirect_dup_output) # i.e. 3>&1 1>&2
+ tmplog = tmpdir + b'/collect.log'
+ exc(dup + [b'collection-status', b'--log-file=' + tmplog, source_url])
# Duplicity output lines of interest look like this (one leading space):
# full 20150222T073111Z 1 noenc
# inc 20150222T073233Z 1 noenc
dup_timestamps = []
- for line in collection_status.splitlines():
- if line.startswith(b' inc '):
- assert(len(line) >= len(b' inc 20150222T073233Z'))
- dup_timestamps.append(line[5:21])
- elif line.startswith(b' full '):
- assert(len(line) >= len(b' full 20150222T073233Z'))
- dup_timestamps.append(line[6:22])
+ with open(tmplog, 'rb') as collect_log:
+ for line in collect_log:
+ if line.startswith(b' inc '):
+ assert(len(line) >= len(b' inc 20150222T073233Z'))
+ dup_timestamps.append(line[5:21])
+ elif line.startswith(b' full '):
+ assert(len(line) >= len(b' full 20150222T073233Z'))
+ dup_timestamps.append(line[6:22])
for i, dup_ts in enumerate(dup_timestamps):
tm = strptime(dup_ts.decode('ascii'), '%Y%m%dT%H%M%SZ')
exc([b'rm', b'-rf', restoredir])
--
2.47.3

Reply all
Reply to author
Forward
0 new messages