Type issue in main

5 views
Skip to first unread message

Mark Hewitt

unread,
May 18, 2026, 11:03:04 AMMay 18
to Johannes Berg, bup list
As Johannes suggested, I noticed a type issue in the current main with a
remote bup server of a different version.

Here, I have bup main (0.34~5f9cf697b3daa3d4d6899f9366ebc1fd64161a32)
running on my test system (called disker) talking to a bup server
(bupman2). The latter is running 0.33.10.

> root@disker:/bupsys/spec# /usr/local/bin/bup
> --bup-dir=/bupsys/data/External-200/bupdata/localbup/disker.bup init
> --remote=bup@bupman2:/bupsys/data/External-200/bupdata/repository/disker
> Traceback (most recent call last):
>   File "/usr/local/lib/bup/bup/main.py", line 221, in main
>     rc = run_subcmd(cmd_module, subcmd, opt['profile'])
>   File "/usr/local/lib/bup/bup/main.py", line 178, in run_subcmd
>     return module.main(args)
>            ~~~~~~~~~~~^^^^^^
>   File "/usr/local/lib/bup/bup/cmd/init.py", line 27, in main
>     loc = main_repo_location(opt.remote, o.fatal)
>   File "/usr/local/lib/bup/bup/repo/__init__.py", line 45, in
> main_repo_location
>     url = url_for_remote_opt(remote)
>   File "/usr/local/lib/bup/bup/config.py", line 23, in url_for_remote_opt
>     url = parse_bytes_path_url(remote, require_auth=True)
>   File "/usr/local/lib/bup/bup/url.py", line 122, in parse_bytes_path_url
>     m = _scheme_and_rest_rx.fullmatch(url)
> TypeError: cannot use a bytes pattern on a string-like object

Hope that helps!

Mark

>

Rob Browning

unread,
May 19, 2026, 6:38:01 PMMay 19
to Mark Hewitt, Johannes Berg, bup list
Mark Hewitt <mjh.br...@gmail.com> writes:

>>     url = url_for_remote_opt(remote)
>>   File "/usr/local/lib/bup/bup/config.py", line 23, in url_for_remote_opt
>>     url = parse_bytes_path_url(remote, require_auth=True)
>>   File "/usr/local/lib/bup/bup/url.py", line 122, in parse_bytes_path_url
>>     m = _scheme_and_rest_rx.fullmatch(url)
>> TypeError: cannot use a bytes pattern on a string-like object
>
> Hope that helps!

It does. Just a bug in main (hiding another bug). I'll fix it.

Thanks
--
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

Rob Browning

unread,
Jun 6, 2026, 2:28:58 PM (8 days ago) Jun 6
to bup-...@googlegroups.com, Mark Hewitt
Thanks to Mark Hewitt for reporting the problem.

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

Pushed to main.

lib/bup/cmd/init.py | 2 +-
test/ext/test-init | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/bup/cmd/init.py b/lib/bup/cmd/init.py
index d84cb4ab..8315546d 100644
--- a/lib/bup/cmd/init.py
+++ b/lib/bup/cmd/init.py
@@ -24,7 +24,7 @@ def main(argv):
o.fatal('cannot initialize both local and remote repo')
loc = URL(scheme=b'file', path=abspath(argv_bytes(extra[0])))
else:
- loc = main_repo_location(opt.remote, o.fatal)
+ loc = main_repo_location(opt.remote and argv_bytes(opt.remote), o.fatal)
try:
with repo_for_location(loc, create=True): pass
except git.GitError as ex:
diff --git a/test/ext/test-init b/test/ext/test-init
index 92474f1b..51f61770 100755
--- a/test/ext/test-init
+++ b/test/ext/test-init
@@ -51,6 +51,10 @@ WVPASS test -d repo/refs/heads
WVPASS test -d repo/objects/pack
WVPASS rm -rf repo

+WVSTART '--remote'
+WVPASS rm -rf repo
+WVPASS bup init --remote -:repo
+
WVEXPRC "$bup_exit_failure" bup init /dev/null


--
2.47.3

Rob Browning

unread,
Jun 6, 2026, 2:29:00 PM (8 days ago) Jun 6
to bup-...@googlegroups.com, Mark Hewitt
When BUP_TEST_LOCAL_SSH is set to a host, attempt to run some of the
tests via ssh connections to that address. Note that the host must
refer to the host containing the current directory (the current source
tree) and that tree's ./bup must be in the default ssh path.

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

Pushed to main.

lib/bup/client.py | 3 ---
test/ext/test-save-restore | 5 +++++
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/bup/client.py b/lib/bup/client.py
index 1b2b0d2b..1485d9c1 100644
--- a/lib/bup/client.py
+++ b/lib/bup/client.py
@@ -208,9 +208,6 @@ class Client:
except OSError as e:
raise ClientError('connect: %s' % e) from e
try:
- assert not url.host, url
- assert not url.user, url
- assert url.port is None, url
self.conn = Conn(self._proc.stdout, self._proc.stdin)
except:
self._proc.terminate()
diff --git a/test/ext/test-save-restore b/test/ext/test-save-restore
index 15f3c9d8..a47f8284 100755
--- a/test/ext/test-save-restore
+++ b/test/ext/test-save-restore
@@ -21,6 +21,11 @@ validate-local-and-remote-restore()
force-delete "$dest"
WVPASS bup restore -r "-:$BUP_DIR" -C "$dest" "$src"
WVPASS "$top/dev/compare-trees" "$cmp_src" "$cmp_dest"
+ if test "${BUP_TEST_LOCAL_SSH:-}"; then
+ force-delete "$dest"
+ WVPASS bup restore -r "$BUP_TEST_LOCAL_SSH:$BUP_DIR" -C "$dest" "$src"
+ WVPASS "$top/dev/compare-trees" "$cmp_src" "$cmp_dest"
+ fi
}


--
2.47.3

Reply all
Reply to author
Forward
0 new messages