I noticed there is an issue in openrsync when a port is specified in the
rsync:// URL, the port number ends up becoming part of the path:

    $ openrsync -r rsync://rsync.roa.tohunet.com:3873/repo/ /tmp/r
    rsync: [sender] change_dir "/3873/repo" (in repo) failed: No such file or 
directory (2)

The below changeset seems to improve the situation, but might not be the
best way to fix it. I found fargs_parse() a bit hard to understand.

OK? Suggestions?

Kind regards,

Job

Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/rsync/main.c,v
retrieving revision 1.65
diff -u -p -r1.65 main.c
--- main.c      2 Aug 2022 20:01:12 -0000       1.65
+++ main.c      12 Feb 2023 21:06:00 -0000
@@ -233,8 +233,12 @@ fargs_parse(size_t argc, char *argv[], s
                    strncasecmp(cp, "rsync://", 8) == 0) {
                        /* rsync://path */
                        cp += 8;
-                       if ((ccp = strchr(cp, ':')))    /* skip :port */
+                       /* skip :port */
+                       if ((ccp = strchr(cp, ':')) != NULL) {
                                *ccp = '\0';
+                               while (cp[len] != '/' && len < j)
+                                       len++;
+                       }
                        if (strncmp(cp, f->host, len) ||
                            (cp[len] != '/' && cp[len] != '\0'))
                                errx(ERR_SYNTAX, "different remote host: %s",

Reply via email to