I agree that the space escaping of the rsync -e part looks like the issue. However, if that is indeed the case, I am surprised no one had stumbled on this before.

The RsyncSshArgs are added to the rsyncArgs like other parts. Here's the relevant code snippet in lib/BackupPC/Xfer/Rsync.pm:124 and :343

            unshift(@$rsyncArgs, "--rsync-path=$conf->{RsyncClientPath}")
                            if ( $conf->{RsyncClientPath} ne "" );
            unshift(@$rsyncArgs, @{$conf->{RsyncSshArgs}})
                            if ( ref($conf->{RsyncSshArgs}) eq 'ARRAY' );

            unshift(@$rsyncArgs, "--rsync-path=$conf->{RsyncClientPath}")
                            if ( $conf->{RsyncClientPath} ne "" );
            unshift(@$rsyncArgs, @{$conf->{RsyncSshArgs}})
                            if ( ref($conf->{RsyncSshArgs}) eq 'ARRAY' );

As I see it,

1) -e as part of the array is irrelevant since calling something SSH arguments makes -e meta information in the context, unless there is some other way of passing it through rsync that makes a difference

2) Since -e indeed requires a single argument that is passed on to SSH, it may be clearer to quote it or to add automatic space escaping

3) As BackupPC per-client overrides work at the variable level rather than array element level, I am uncertain there is a point in using an array in the first place


How about it'd work like this (again, I am no Perl coder and did not test this code yet, this is to illustrate):

            unshift(@$rsyncArgs, "--rsh=\"$conf->{RsyncSshArgs}\"")
                            if ( $conf->{RsyncSshArgs} ne "" );

And changing the RsyncSshArgs UI elements and configs' format respectively. This breaks existing configs unless there is a migration helper of course, so keeping the array may make sense for that reason. That would also limit the fix to the lines above, just adding a bit more mangling instead.


Thinking of it further, this actually implies a potentially serious data loss scenario in cases where rsync and ssh arguments coincide with different functions. Take for example -C that I used below. Passed to SSH, it adds compression. But passed to rsync, it excludes files (short for --cvs-exclude). I was preliminarily able to confirm this, and it also explains why the errors I was getting were related to -c rather than -C which came before.


Best regards,

Johan


On 1/15/19 8:23 PM, Jan Stransky wrote:
My guess is, that the -e parameter needs all ssh parameters included as
a value. That is what the escaped spaces IMHO does. E.g. whole
"/usr/bin/ssh\ -l\ ubuntu\ -C\ -c\ aes256-...@openssh.com" is single
value for -e.

It might be a feature of the rsync_bpc. I am not sure, how this works
with regular rsync. I certainly use very different syntax with normal
rsync :-)

If this is true for clearer config, you are asking for, a new variable
$sshArgs or so might be considered?
Cheers,
Jan

On 1/15/19 10:18 AM, Johan Ehnberg wrote:
Yes,

Multiple lines:

Running: /usr/local/bin/rsync_bpc --bpc-top-dir /var/lib/backuppc 
--bpc-host-name test.i.molnix.com --bpc-share-name / --bpc-bkup-num 1 
--bpc-bkup-comp 0 --bpc-bkup-prevnum -1 --bpc-bkup-prevcomp -1 
--bpc-bkup-inode0 75573 --bpc-attrib-new --bpc-log-level 1 -e /usr/bin/ssh\ -l\ 
ubuntu -C -c\ aes256-...@openssh.com --rsync-path=sudo\ /usr/bin/rsync --super 
--recursive --protect-args --numeric-ids --perms --owner --group -D --times 
--links --hard-links --delete --delete-excluded --partial --log-format=log:\ 
%o\ %i\ %B\ %8U,%8G\ %9l\ %f%L --stats --timeout=72000 --exclude=/proc 
test.i.molnix.com:/ /
incr backup started for directory /
Xfer PIDs are now 17341
This is the rsync child about to exec /usr/local/bin/rsync_bpc
rsync_bpc: -c aes256-...@openssh.com: unknown option

Combined line, (note also the space escaping around the concerned
arguments):

Running: /usr/local/bin/rsync_bpc --bpc-top-dir /var/lib/backuppc 
--bpc-host-name test.i.molnix.com --bpc-share-name / --bpc-bkup-num 4 
--bpc-bkup-comp 0 --bpc-bkup-prevnum 3 --bpc-bkup-prevcomp 0 --bpc-bkup-inode0 
75725 --bpc-attrib-new --bpc-log-level 1 -e /usr/bin/ssh\ -l\ ubuntu\ -C\ -c\ 
aes256-...@openssh.com --rsync-path=sudo\ /usr/bin/rsync --super --recursive 
--protect-args --numeric-ids --perms --owner --group -D --times --links 
--hard-links --delete --delete-excluded --partial --log-format=log:\ %o\ %i\ 
%B\ %8U,%8G\ %9l\ %f%L --stats --timeout=72000 --exclude=/proc 
test.i.molnix.com:/ /
incr backup started for directory /
Xfer PIDs are now 17737
This is the rsync child about to exec /usr/local/bin/rsync_bpc
Xfer PIDs are now 17737,17739

Best regards,
Johan

On 1/15/19 10:42 AM, Jan Stransky wrote:
In the logs, you can see actual commands issued. Have you compared those?

Cheers,

Jan

On 14/01/2019 10:17, Johan Ehnberg wrote:
Hello,

I stumbled upon this weirdness when benchmarking offloadable SSH
ciphers using the rsync transfer method.

In short, splitting up the RsyncSshArgs I use on multiple lines fails:

'-e',

'$sshPath -l ubuntu',

'-C',

'-c aes256-...@openssh.com'


and combining them on one line works (but may be a fluke):

'-e',

'$sshPath -l ubuntu -C -c aes256-...@openssh.com'


Errors vary between these:

No files dumped for share /

rsync error: syntax or usage error (code 1) at main.c(1572) [client=3.1.2.0]

The suspect is some escaping problem due to the @ sign since it
indicates an array in Perl. However, escaping it (-c
aes256-gcm\@openssh.com) does not help. I am not into Perl more than
that. Any thoughts?

Best regards,

Johan Ehnberg

--
Signature
*Johan Ehnberg*

Founder, CEO

Molnix Oy


jo...@molnix.com <mailto:jo...@molnix.com>

+358 50 320 96 88

molnix.com <https://molnix.com>


/The contents of this e-mail and its attachments are for the use of
the intended recipient only, and are confidential and may contain
legally privileged information. If you are not the intended recipient
or have otherwise received the e-mail in error, please notify the
sender by replying to this e-mail immediately and then delete it
immediately from your system. Any dissemination, distribution,
copying or use of this communication without prior and explicit
permission of the sender is strictly prohibited./

/*Please consider the environment - do not print this e-mail unless
you really need to.*/



_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
--
Signature
*Johan Ehnberg*

Founder, CEO

Molnix Oy


jo...@molnix.com <mailto:jo...@molnix.com>

+358 50 320 96 88

molnix.com <https://molnix.com>


/The contents of this e-mail and its attachments are for the use of the
intended recipient only, and are confidential and may contain legally
privileged information. If you are not the intended recipient or have
otherwise received the e-mail in error, please notify the sender by
replying to this e-mail immediately and then delete it immediately from
your system. Any dissemination, distribution, copying or use of this
communication without prior and explicit permission of the sender is
strictly prohibited./

/*Please consider the environment - do not print this e-mail unless you
really need to.*/


This body part will be downloaded on demand.


This body part will be downloaded on demand.


_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
--
Signature
*Johan Ehnberg*

Founder, CEO

Molnix Oy


jo...@molnix.com <mailto:jo...@molnix.com>

+358 50 320 96 88

molnix.com <https://molnix.com>


/The contents of this e-mail and its attachments are for the use of the intended recipient only, and are confidential and may contain legally privileged information. If you are not the intended recipient or have otherwise received the e-mail in error, please notify the sender by replying to this e-mail immediately and then delete it immediately from your system. Any dissemination, distribution, copying or use of this communication without prior and explicit permission of the sender is strictly prohibited./

/*Please consider the environment - do not print this e-mail unless you really need to.*/

_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to