[PATCH 1/1] bup-on: document user@ support; favor user and host over port

0 views
Skip to first unread message

Rob Browning

unread,
Feb 23, 2026, 2:32:11 PM (3 days ago) Feb 23
to bup-...@googlegroups.com
Mention support for naming a user in the destination, and since the
port is much less likely to contain a colon, split the port off "from
the right" so that a@b@x:y:z indicates port z, host x:y, user
a@b (openssh, at least, does the same for @).

(Setting aside whether we want to support a port with a colon in it,
and whether such a port would work on systems we support.)

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

Pushed to main.

Documentation/bup-on.1.md | 8 ++++----
lib/bup/cmd/on.py | 15 ++++++---------
2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/Documentation/bup-on.1.md b/Documentation/bup-on.1.md
index 7f91577e..c8c4fae0 100644
--- a/Documentation/bup-on.1.md
+++ b/Documentation/bup-on.1.md
@@ -8,13 +8,13 @@ bup-on - run a bup server locally and client remotely

# SYNOPSIS

-bup on \<hostname\> index ...
+bup on [*user*@]*host*[:*port*] index ...

-bup on \<hostname\> save ...
+bup on [*user*@]*host*[:*port*] save ...

-bup on \<hostname\> split ...
+bup on [*user*@]*host*[:*port*] split ...

-bup on \<hostname\> get ...
+bup on [*user*@]*host*[:*port*] get ...

# DESCRIPTION

diff --git a/lib/bup/cmd/on.py b/lib/bup/cmd/on.py
index 1d52eda7..f2950d2e 100644
--- a/lib/bup/cmd/on.py
+++ b/lib/bup/cmd/on.py
@@ -9,7 +9,7 @@ from bup.io import byte_stream


optspec = """
-bup on <hostname> <index|save|split|get> ...
+bup on <[user@]host[:port]> <index|save|split|get> ...
"""

def main(argv):
@@ -25,13 +25,10 @@ def main(argv):
def handler(signum, frame):
raise SigException(signum)

- remote = argv_bytes(extra[0]).split(b':')
- argv = [argv_bytes(x) for x in extra[1:]]
-
- if len(remote) == 1:
- hostname, port = (remote[0], None)
- else:
- hostname, port = remote
+ dest, *argv = (argv_bytes(x) for x in extra)
+ dest, colon, port = dest.rpartition(b':')
+ if not colon:
+ dest, port = port, None

signal.signal(signal.SIGTERM, handler)
signal.signal(signal.SIGINT, handler)
@@ -43,7 +40,7 @@ def main(argv):
sp = None
p = None
ret = 99
- p = ssh.connect(hostname, port, b'on--server', stderr=PIPE)
+ p = ssh.connect(dest, port, b'on--server', stderr=PIPE)
try:
argvs = b'\0'.join([b'bup'] + argv)
p.stdin.write(struct.pack('!I', len(argvs)) + argvs)
--
2.47.3

Reply all
Reply to author
Forward
0 new messages