> The point is that the original escaping DOUBLE escapes an equals sign: > foo\\\=bar > It shouldn't, there's no reason to.If you paste into your command line: rsync -e ssh\ -l\ backup\ -i\ /etc/synco/id_rsa\ -o\ ConnectTimeout\\\=60\ -o\ BatchMode\\\=yes The list of arguments would be (i.e. the values in ARGV): ['rsync', '-e', 'ssh -l backup -i /etc/synco/id_rsa -o ConnectTimeout\=60 -o BatchMode\=yes'] The command ssh -l backup -i /etc/synco/id_rsa -o ConnectTimeout\=60 -o BatchMode\=yes Is a correct and valid shell command. When RSync parses this in do_cmd, it should convert the '\=` sequence into '=' but it doesn't.. This intuition is derived from the fact that if you instead passed the string to `system('ssh -l backup -i /etc/synco/id_rsa -o ConnectTimeout\=60 -o BatchMode\=yes')` that the ARGV generated would be ['ssh', '-l', 'backup', '-i', '/etc/synco/id_rsa', '-o', 'ConnectTimeout=60', '-o', 'BatchMode=yes']. Basically, even if there WAS no reason to do so, doesn't mean it's invalid or undesirable. In theory, even passing in -e \\s\\s\\h should be valid. On 30 October 2016 at 01:13, Paul Slootman <paul+rsync at wurtel.net> wrote:> On Sat 29 Oct 2016, Samuel Williams wrote: > >> I'm not proposing some additional characters to split on, but quite >> the opposite, to handle the backslash escaped spaces correctly and NOT >> split. Rest assured, there is no bug with the original escaping. For >> your edification: >> >> $ echo \I\'\m\ \a\ \s\t\r\i\n\g >> I'm a string > > The point is that the original escaping DOUBLE escapes an equals sign: > foo\\\=bar > It shouldn't, there's no reason to. > > > Paul > > -- > 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
On Sat, Oct 29, 2016 at 5:36 AM, Samuel Williams < space.ship.traveller at gmail.com> wrote:> The command > > ssh -l backup -i /etc/synco/id_rsa -o ConnectTimeout\=60 -o BatchMode\=yes > > Is a correct and valid shell command. >It is, but there is no shell involved, and assuming that a shell is being used is invalid. Adding backslash escaping now could potentially screw up anyone currently passing a backslash in their existing rsync scripts (a small group of people, but probably non-zero). It's tempting to go ahead and do this, but I think I'll just leave it as it is. If you want to work around that buggy escaping library, you could change "ssh" to "ssh-nobs" and put the following into that file: #!/usr/bin/perl exec 'ssh', map { s/\\(.)/$1/g; $_ } @ARGV; That adds backslash removal on the way to the ssh. It does not allow you to backslash escape spaces, though, but someone could extend the script to support that. ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20161029/61695557/attachment.html>
> assuming that a shell is being used is invalidI never made this assumption. I looked directly at the source code and I stated that "I feel that this function should also handle backslash escapes." I think the assumption that splitting the command works the same way as (all?) major shells, is not inappropriate given the circumstances, and it seems like you agree.> but probably non-zeroWell, I understand where you are coming from. You don't want to break existing code. The work-around is to use quotes to escape the white-space sequence. It's okay.. But it's also a surprise that backslash escape sequences don't work according to intuition of how commands are normally executed. If you supplied the string in -e to system, it would work as expected.. Unfortunately, this is the default when using Shellwords.join in Ruby. So, I had to write a custom RSync "join" function to produce an appropriate command for -e argument. On 30 October 2016 at 04:49, Wayne Davison <wayned at samba.org> wrote:> On Sat, Oct 29, 2016 at 5:36 AM, Samuel Williams > <space.ship.traveller at gmail.com> wrote: >> >> The command >> >> ssh -l backup -i /etc/synco/id_rsa -o ConnectTimeout\=60 -o BatchMode\=yes >> >> Is a correct and valid shell command. > > > It is, but there is no shell involved, and assuming that a shell is being > used is invalid. Adding backslash escaping now could potentially screw up > anyone currently passing a backslash in their existing rsync scripts (a > small group of people, but probably non-zero). It's tempting to go ahead and > do this, but I think I'll just leave it as it is. > > If you want to work around that buggy escaping library, you could change > "ssh" to "ssh-nobs" and put the following into that file: > > #!/usr/bin/perl > exec 'ssh', map { s/\\(.)/$1/g; $_ } @ARGV; > > That adds backslash removal on the way to the ssh. It does not allow you to > backslash escape spaces, though, but someone could extend the script to > support that. > > ..wayne.. >