The \ escapes are for the shell.  Rsync never sees them and therefore
can't honor them.

On 10/20/2016 05:24 AM, Samuel Williams wrote:
> Hello,
> 
> I'm using Ruby's Shellwords module, which generates a string from an
> array, suitable for shell evaluation.
> 
> Ruby's implementation prefers escaping whitespace with a backslash
> rather than quotes. However, this appears to cause some kind of issue
> in Rsync when it computes argv from -e option.
> 
> Here is an example command generated by some Ruby code:
> 
> rsync --archive --stats -e ssh\ -l\ backup\ -i\ /etc/synco/id_rsa\ -o\
> ConnectTimeout\\\=60\ -o\ BatchMode\\\=yes --link-dest
> ../../latest/etc/ /etc/
> example.backup.server.com:/tank/backup/servers/blah/latest.snapshot/etc/
> 
> We can check that something like this is valid:
> 
> files% echo foo\ bar\\\=baz
> foo bar\=baz             -- what Rsync should be receiving
> files% echo foo bar\=baz
> foo bar=baz              -- What Rsync should be executing
> 
> However this gives me an error
> 
> command-line: line 0: Bad configuration option: connecttimeout\\
> rsync: connection unexpectedly closed (0 bytes received so far) [sender]
> rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
> 
> I think the problem here is the "ConnectTimeout\\\=60", in particular
> how the equals symbol is escaped.
> 
> I'm looking in the function:
> 
> static pid_t do_cmd(char *cmd, char *machine, char *user, char
> **remote_argv, int remote_argc,
>    int *f_in_p, int *f_out_p)
> 
> This function splits based purely on whitespace:
> 
>      args[argc++] = t;
>      while (*f != ' ' || in_quote) {
>          // consume token...
> 
> I feel that this function should also handle backslash escapes.
> 
> I also checked using strace and it appears that this is the issue, but
> I'm open to suggestions/ideas.
> 
> Kind regards,
> Samuel
> 

-- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
        Kevin Korb                      Phone:    (407) 252-6853
        Systems Administrator           Internet:
        FutureQuest, Inc.               ke...@futurequest.net  (work)
        Orlando, Florida                k...@sanitarium.net (personal)
        Web page:                       http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to