I brought this up on the list years ago and was told it's a feature, not a bug.
Even if some other GNU or Linux commands have this "feature", it still violates the principle of least surprise. It's also pretty hard to discover because a null argument is literally invisible. Joe On 4/17/19 9:54 AM, just subscribed for rsync-qa from bugzilla via rsync wrote: > https://bugzilla.samba.org/show_bug.cgi?id=13901 > > Bug ID: 13901 > Summary: Empty quotes adds cwd to SRC directories > Product: rsync > Version: 3.1.3 > Hardware: x64 > OS: Linux > Status: NEW > Severity: normal > Priority: P5 > Component: core > Assignee: wa...@opencoder.net > Reporter: daniel@grundstrom.email > QA Contact: rsync...@samba.org > > Created attachment 15076 > --> https://bugzilla.samba.org/attachment.cgi?id=15076&action=edit > For cmd 'rsync "$UNSET_VAR" --debug=ALL5 --verbose --recursive -- /data/src/ > /data/dest/' > > Hi! It's my first bug report here so let me know if I should clarify anything! > > If you add empty quotes to the rsync command line, it is interpreted as the > current working directory ("."), and added to the SRC args. It doesn't matter > if the quotes come before or after any options, if it comes before "--" or if > there are other source directories specified. > > This is a problem if you specify quoted bash variables on the command line and > one of them happens to be unset. > > /data/cwd $ ls > file-i-dont-want-to-copy.txt > /data/cwd $ rsync "$UNSET_VAR" --recursive --verbose -- /data/src/ /data/dest/ > sending incremental file list > file-i-dont-want-to-copy.txt > file-i-want-to-copy.jpg > > sent 819,001 bytes received 54 bytes 1,638,110.00 bytes/sec > total size is 818,581 speedup is 1.00 > > I have attached the output of the command with '--debug=ALL5' added, if it > helps. > -- 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