Bug 13901 - Empty quotes adds cwd to SRC directories
Empty quotes adds cwd to SRC directories
Status: NEW
Product: rsync
Classification: Unclassified
Component: core
3.1.3
x64 Linux
: P5 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-04-17 13:54 UTC by Daniel Alm Grundström
Modified: 2019-04-17 13:54 UTC (History)
0 users

See Also:


Attachments
For cmd 'rsync "$UNSET_VAR" --debug=ALL5 --verbose --recursive -- /data/src/ /data/dest/' (4.51 KB, text/x-log)
2019-04-17 13:54 UTC, Daniel Alm Grundström
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Alm Grundström 2019-04-17 13:54:54 UTC
Created attachment 15076 [details]
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.