Bug 1091 - targetshouldbedirectory not set for remote wildcards
Summary: targetshouldbedirectory not set for remote wildcards
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: scp (show other bugs)
Version: 3.8.1p1
Hardware: All Linux
: P3 normal
Assignee: Assigned to nobody
URL:
Keywords: low-hanging-fruit
Depends on:
Blocks:
 
Reported: 2005-09-25 12:16 AEST by Russ Cox
Modified: 2006-04-18 15:07 AEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Russ Cox 2005-09-25 12:16:09 AEST
If there are multiple file names matching a remote wildcard expression, then
"scp machine:wildcard asdf" will, if asdf does not exist, create asdf for the
first file and then overwrite it for each additional file.  I would rather it
print an error without copying anything, or at least print an error without
copying more than one file.  It's terribly frustrating to watch one file finish
and then see it immediately overwritten.

For example:

    $ scp amsterdam:*.c /tmp/a
    ether82557.c                                 100%   29KB  29.4KB/s   00:00    
    sdaoe.c                                      100%   16KB  15.8KB/s   00:01    
    sdaow.c                                      100%   44KB  44.1KB/s   00:00    
    serial.c                                     100% 1480     1.5KB/s   00:00    
    x.c                                          100%  220     0.2KB/s   00:00    
    $ ls -l /tmp/a
    -rw-rw-r--  1 rsc rsc 220 2005-09-24 22:14 /tmp/a
    $ 

Russ Cox
rsc@swtch.com
Comment 1 Damien Miller 2006-04-18 15:07:39 AEST
We have this "half right" now, in that 

scp hosta:foo hosta:bar /tmp/abc

will check that /tmp/abc is a directory, but there is no way to know a priori that :

scp hosta:* /tmp/abc

will yield multiple files. I suppose we could modify sink() to raise an error on the 2nd file transferred, but that isn't optimal either.

this is another limitation of the stupid scp "protocol"