Bug 1205

Summary: scp back-slash escaping of spaces ignored after username@hostname: tag
Product: Portable OpenSSH Reporter: Davide Cescato <dcescato>
Component: scpAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED WONTFIX    
Severity: normal Keywords: low-hanging-fruit
Priority: P3    
Version: 4.3p2   
Hardware: ix86   
OS: Linux   

Description Davide Cescato 2006-07-03 23:54:51 AEST
Back-slash escaping of spaces works when accessing local files:

[genie@homeland ~]$ echo "hello" > spa\ ce
[genie@homeland ~]$ ls -l spa\ ce
-rw-rw-r-- 1 genie genie 6 Jul  3 14:58 spa ce
[genie@homeland ~]$  scp /home/genie/spa\ ce bugzilla@armageddon.ethz.ch:/home/bugzilla
spa ce                                                   100%    6     0.0KB/s   00:00


The file is actually on the remote machine:

[bugzilla@armageddon ~]$ ls -l spa\ ce
-rw-rw-r-- 1 bugzilla bugzilla 6 Jul  3 14:58 spa ce


If I now try to copy the file from the remote machine, I get the following error:

[genie@homeland ~]$ rm spa\ ce
[genie@homeland ~]$ scp bugzilla@armageddon.ethz.ch:/home/bugzilla/spa\ ce . 
scp: /home/bugzilla/spa: No such file or directory
scp: ce: No such file or directory


Hence, back-slash escaping of spaces after a "username@hostname:" tag seems to be ignored.
Comment 1 Tomas Mraz 2006-07-04 17:23:14 AEST
I'd say that this is a feature rather than a bug. The path is again shell expanded on the remote machine.
This will work:
scp "<host>:<path>/spa\\ ce" .
Comment 2 Damien Miller 2006-07-12 10:49:51 AEST
Sorry - we can't fix this: it is a 20+ year old limitation of rcp that scp has inherited and changing the behaviour of scp would break many people's working scripts. 
Comment 3 Darren Tucker 2006-10-07 11:45:30 AEST
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.