Bug: Copying several files to non-directory.

Björn Augustsson august at chalmers.se
Fri Jan 20 23:17:22 EST 2006

Dear openssh people,

Here's something to try:

$ echo a >a
$ echo b >b
$ echo c >c
$ scp a b c
$ echo $?
$ cat a b c

Ouch!  Also, for comparison:

$ cp a b c
cp: copying multiple files, but last argument `c' is not a directory
Try `cp --help' for more information.
$ rcp a b c
rcp: c: Not a directory.

Note that the cp behavior is specified in SuSv2.
(http://www.opengroup.org/onlinepubs/007908799/xcu/cp.html, "Second synopsis")

Also, and this might be a separate bug, note how openssh exits with
return code of 1.

This was verified using various versions of scp from 3.6.1p2 to 4.2, on 
linux (various versions) and openbsd.

Björn Augustsson      Sysadmin     IT Systems & Services
Chalmers tekniska högskola     Chalmers University of Technology
         "Damn spooky analog crap." -- John Carmack.

More information about the openssh-unix-dev mailing list