Bug 891 - possible problem with non-printing characters during scp copy
Summary: possible problem with non-printing characters during scp copy
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: scp (show other bugs)
Version: 3.6.1p2
Hardware: ix86 Linux
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
: 1302 (view as bug list)
Depends on:
Blocks: V_4_7
  Show dependency treegraph
 
Reported: 2004-07-04 14:18 AEST by Bill Parker
Modified: 2008-04-04 09:54 AEDT (History)
2 users (show)

See Also:


Attachments
Encode newlines in filename for scp transfer (1.08 KB, patch)
2004-07-04 16:14 AEST, Darren Tucker
no flags Details | Diff
Update patch to current, remove debugging. (1.18 KB, patch)
2007-06-12 22:11 AEST, Darren Tucker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Parker 2004-07-04 14:18:16 AEST
Hello,

System:  Red Hat Workstation Edition
Kernel:  Linux content 2.4.21-15.0.2.ELcustom #2 SMP Sun Jun 27 10:04:31 PDT 
2004 i686 i686 i386 GNU/Linux
OpenSSH: [content@content content]$ rpm -q openssh

version is openssh-3.6.1p2-33.30.1

   I encountered a problem which might be a bug in 'scp' when attempting to do 
a recursive copy of files from a existing linux system onto a new linux ystem.  
The problem happened when the 'scp' reached a directory which had a 
file '???.HTM' in it, and the scp aborted with the following message:

Protocol Control Error

I attempted to repeat the 'scp' the next day, and it died out in the same 
directory as the previous day, with the same error message.  I tried to remove 
the file in question, but 'rm' wouldn't allow me to, so I used 'rm -i *.HTM' so 
that I would be asked about each file in the directory one at a time, when it 
got to the '???.HTM', it showed that the file was actually 
\n\r\n.HTM (and the rm -i allowed me to remove it)

after this file was removed, I ran the scp again the following day, and the job 
completed normally without any errors at all.

If you need more information, please email me at dogbert@netnevada.net

Bill Parker
Comment 1 Darren Tucker 2004-07-04 16:14:30 AEST
Created attachment 680 [details]
Encode newlines in filename for scp transfer

It looks like the sending scp bails on the file because the name contains a
newline (inside the protocol the file details are sent as "Cmodes size name\n"
so there's no way to encode a literal newline into a filename).  When the
sending scp bails, the receiving scp gets out of sync and drops the connection.


We could do something like the attached which encodes them as printable chars. 
The file will transfer but the name will be wrong.

On the other hand, the scp protocol is obsolete and has unfixable limitations,
it might not be worth fiddling with it any more.

If anyone wants to play with this, try:
mkdir /tmp/tmp1
perl -e 'open(a, ">/tmp/tmp1/t\n\r\n.HTM")'; 
scp -r /tmp/tmp1 localhost:/tmp/tmp2
Comment 2 Damien Miller 2007-05-17 22:57:33 AEST
*** Bug 1302 has been marked as a duplicate of this bug. ***
Comment 3 Darren Tucker 2007-06-12 22:11:42 AEST
Created attachment 1306 [details]
Update patch to current, remove debugging.
Comment 4 Darren Tucker 2007-06-12 23:59:27 AEST
Thanks for the report, patch id #1306 will be in the 4.7 release.
Comment 5 Damien Miller 2008-04-04 09:54:57 AEDT
Close resolved bugs after release.