Local --M--fake-super fails and creates local directory copy
(Also posted to mailing list as https://lists.samba.org/archive/rsync/2023-July/033045.html)
I am on rsync version 3.2.7 protocol version 31, currently on an Arch Linux.
The following I would expect to copy the contents of 'a' to 'c', based on my understanding of the the advice in man rsync for using --fake-super locally:
mkdir a b c
touch a/hello
rsync -M--fake-super -a a/ b/
rsync --super -M--fake-super -a b/ c/
Instead I see 'c' unchanged, and a garbage directory created with the expected contents in the local directory:
~/tmp $ ls
''$'\001' a b c
~/tmp $ ls -la *
''$'\001':
total 8
drwxr-xr-x 2 zachary users 4096 Jul 15 02:10 .
drwxr-xr-x 6 zachary users 4096 Jul 15 02:10 ..
-rw-r--r-- 1 zachary users 0 Jul 15 02:10 hello
a:
total 8
drwxr-xr-x 2 zachary users 4096 Jul 15 02:10 .
drwxr-xr-x 6 zachary users 4096 Jul 15 02:10 ..
-rw-r--r-- 1 zachary users 0 Jul 15 02:10 hello
b:
total 8
drwxr-xr-x 2 zachary users 4096 Jul 15 02:10 .
drwxr-xr-x 6 zachary users 4096 Jul 15 02:10 ..
c:
total 8
drwxr-xr-x 2 zachary users 4096 Jul 15 02:10 .
drwxr-xr-x 6 zachary users 4096 Jul 15 02:10 ..
Note, this always writes the garbage directory into the current directory, even if it is on a different filesystem than the source, destination, and (/tmp or -T).
A workaround is to use rsync to/from localhost:
You can use this script as --rsh=/path/to/script to work around this bug without the need to setup SSH and authentication.
#!/bin/bash -eu
shift 3
exec "$@"