[PATCH] Improve error message in scp (bz1768)

Jakub Jelen jjelen at redhat.com
Fri Jan 9 03:44:57 AEDT 2015

I started digging in some problems and problems and bugzillas and this 
was one problem I found and managed to solve so I'm letting you know 
about this with patch. Severity is not critical, but according to other 
users and bugzillas, it can mislead someone (during at almost 10 years 
of existence according to Ubuntu).

To get to the point, there is problem in current version, that you are 
getting strange error message if you try to scp existing local file to 
non-existing remote directory (ending with slash). The most we can say 
by example:
$ scp  file host:new_dir/

This example ends up with quite strange error message:
 > scp: new_dir/: Is a directory

Which doesn't make sense from the beginning, but after some digging in 
code, you see that this error message is coming from place where scp is 
trying to write the received data into file ending with slash (which 
can't end other way than this).

My patch is trying to fix this specific issue and not to break any other 
functionality, not like the previous attempt mentioned in bugzilla. As 
I'm mentioning in bugzilla, all tests in regress passed and I also added 
one more to verify that this edge condition is covered with reasonable 
error message.

Once more, link to bugzilla:

TL;DR: Can someone approve this patch for and include it in openssh?

Best regards,
Jakub Jelen

More information about the openssh-unix-dev mailing list