empty quotes for rsync parameter
Matt McCutchen
matt at mattmccutchen.net
Sun Oct 11 02:23:05 MDT 2009
On Sun, 2009-10-11 at 00:37 -0700, Wolfram Volpi wrote:
> Why does inserting an empty quote ("") into a rsync command cause the current directory to be backed up?
>
> Not sure if this is a UNIX-syntax question or rsync-syntax question.
>
> Code:
> #!/bin/sh
>
> echo "\nspace between quotes has no effect; only music is backed up:"
> rsync -ilrtn " " /home/wolf/music /backups/backup1
Um, no, it either backs up the file in the current directory whose name
is a single space, or gives an error that such a file does not exist.
> echo "\nempty quotes backs up current directory and music:"
> rsync -ilrtn "" /home/wolf/music /backups/backup1
This appears to be a feature:
http://gitweb.samba.org/?p=rsync.git;a=blob;f=flist.c;h=a167c3b9fb15d591d3e82aa37fddaa4c8c9a3e6e;hb=HEAD#l2118
It makes perfect sense to me that the empty path, as a relative path
with zero components, would refer to the current directory. In fact,
old versions of *nix behaved that way, but current ones reject the empty
path:
http://www.kernel.org/doc/man-pages/online/pages/man7/path_resolution.7.html
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11
So one could argue that rsync should reject it too. I don't care about
the issue personally.
--
Matt
More information about the rsync
mailing list