Nunuz Yourbiz
2004-Jan-09 14:55 UTC
Problems with rsync with dirctories with spaces in the name
Hi guys I have read read the why's and whyfores and howto's and whento's about posting for help, but I'm not sure whether this has already been addressed - plenty other Win/spaces-in-dir-names issues have been. I was running rsync to copy stuff off of a Windows disk onto a Windows disk on another machine via Linux - Mdk 9.1 rsync - (rsync-2.5.7-0.1.92mdk) , when I first noticed the problem. I have reproduced it below. The command I used was rsync -avz -e ssh /mnt/D/Program\ Files/Activision/WizardsWarriors/* richard1@perthmdk:/mnt/downloads/Program\ Files/Activision This command gave me the following in the /mnt/downloads directory [richard1@PerthMdk richard1]$ ll /mnt/downloads/ total 5344753 drwxrwxr-x 29 richard1 richard1 4184 Jan 9 21:54 Program/ It seems that the rsync (or the shell or whatever) loses everything after the whitespace (even though it has a \) Is this a documented bug? If so is it a problem with rsync or the shell? I did try with scp and got the following [richard1@SelousMdk richard1]$ scp -r /mnt/D/Program\ Files/Activision/WizardsWarriors/* richard1@perthmdk:/mnt/downloads/Program\ Files/Activision scp: ambiguous target So I suppose it might be a shell problem Thanks for the great product RichardM _________________________________________________________________ E-mail just got a whole lot better. New ninemsn Premium. Click here http://ninemsn.com.au/premium/landing.asp
jw schultz
2004-Jan-09 15:32 UTC
Problems with rsync with dirctories with spaces in the name
On Fri, Jan 09, 2004 at 10:55:38PM +0800, Nunuz Yourbiz wrote:> Hi guys > > I have read read the why's and whyfores and howto's and whento's about > posting for help, but I'm not sure whether this has already been addressed > - plenty other Win/spaces-in-dir-names issues have been. > > I was running rsync to copy stuff off of a Windows disk onto a Windows disk > on another machine via Linux - Mdk 9.1 rsync - (rsync-2.5.7-0.1.92mdk) , > when I first noticed the problem. > I have reproduced it below. > > The command I used was > rsync -avz -e ssh /mnt/D/Program\ Files/Activision/WizardsWarriors/* > richard1@perthmdk:/mnt/downloads/Program\ Files/Activision > > > This command gave me the following in the /mnt/downloads directory > [richard1@PerthMdk richard1]$ ll /mnt/downloads/ > total 5344753 > drwxrwxr-x 29 richard1 richard1 4184 Jan 9 21:54 Program/ > > It seems that the rsync (or the shell or whatever) loses everything after > the whitespace (even though it has a \) > > Is this a documented bug? If so is it a problem with rsync or the shell? I > did try with scp and got the following > [richard1@SelousMdk richard1]$ scp -r /mnt/D/Program\ > Files/Activision/WizardsWarriors/* > richard1@perthmdk:/mnt/downloads/Program\ Files/Activision > scp: ambiguous target > > So I suppose it might be a shell problemIt is a shell problem of sorts. Your source path should be OK but you would be better off leaving off the trailing * so the shell won't glob. The real problem is the destination path. The destination path has a space in it but you only escaped it once. That protects it from the local shell but not the remote shell. Rsync is going to invoke ssh with the destination path on the command-line which will cause ssh to invoke your login shell on the remote end with that command-line as arguments. The space needs to be escaped or quoted in a way that will get to the remote end. That either means nested quotes or stacked backslashes. Hmm, just a thought here for the other developers: Perhaps rsync should check the source/dest portions of remote argument list for whitespace and if there but no quotes or backslashes insert backslashes or surrounding quotes. That way a path could be specified for local or remote in the same way even if it has spaces in it. Having a test for quotes or backslashes would provide backwards compatability. -- ________________________________________________________________ J.W. Schultz Pegasystems Technologies email address: jw@pegasys.ws Remember Cernan and Schmitt