Bug 2919

Summary: Quoting of filenames with spaces is inconsistent when downloading/uploading
Product: Portable OpenSSH Reporter: Jari <bugzilla>
Component: scpAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED WONTFIX    
Severity: normal CC: djm
Priority: P5    
Version: 7.5p1   
Hardware: amd64   
OS: Linux   

Description Jari 2018-10-17 20:26:36 AEDT
This is something that has been bugging me for a while and I always stumble on it trying to remember which form to use
I can't find anything in the changelog that looks similar to this having been fixed 

Downloading:
vague@IS-C0HVFBY:~$ /usr/bin/scp root@amodev:"/root/projects/management-packs/XI\ Gridhost.json" .
root@amodev's password:
XI Gridhost.json
vague@IS-C0HVFBY:~$ /usr/bin/scp root@amodev:"/root/projects/management-packs/XI Gridhost.json" .                                                                                                                                                                                                                             
root@amodev's password:                                                                                                                                                                                                                                                                                                       
scp: /root/projects/management-packs/XI: No such file or directory                                                                                                                                                                                                                                                            
scp: Gridhost.json: No such file or directory  
vague@IS-C0HVFBY:~$ /usr/bin/scp "root@amodev:/root/projects/management-packs/XI\ Gridhost.json" .                                                                                                                                                                                                                            
root@amodev's password:                                                                                                                                                                                                                                                                                                       
XI Gridhost.json
vague@IS-C0HVFBY:~$ /usr/bin/scp root@amodev:/root/projects/management-packs/XI\ Gridhost.json .                                                                                                                                                                                                                              
root@amodev's password:                                                                                                                                                                                                                                                                                                       
scp: /root/projects/management-packs/XI: No such file or directory                                                                                                                                                                                                                                                            
scp: Gridhost.json: No such file or directory

Uploading:
vague@IS-C0HVFBY:~$ /usr/bin/scp "XI\ Gridhost.json" admin@remote:                                                                                                                                                                                                                                                           
admin@remote's password:                                                                                                                                                                                                                                                                                                    
XI\ Gridhost.json: No such file or directory     
vague@IS-C0HVFBY:~$ /usr/bin/scp "XI Gridhost.json" admin@remote:                                                                                                                                                                                                                                                            
admin@remote's password:                                                                                                                                                                                                                                                                                                    
XI Gridhost.json                                                                                                                                                                                                                                                                             
vague@IS-C0HVFBY:~$ /usr/bin/scp XI\ Gridhost.json admin@remote:                                                                                                                                                                                                                                                            
admin@remote's password:                                                                                                                                                                                                                                                                                                    
XI Gridhost.json
Comment 1 Damien Miller 2020-01-26 00:31:53 AEDT
Unfortunately this is inherent to the way that scp works: one set of quote expansion is performed by your local shell and another by the remote shell that executes scp. This behaviour is inherited from BSD rcp from ~29 years ago :(
Comment 2 Damien Miller 2020-02-14 15:59:23 AEDT
Closing all resolved bug with release of openssh-8.2