bugzilla-daemon at mindrot.org
2007-Apr-04 10:12 UTC
[Bug 1302] scp failes to copy a file with newline
http://bugzilla.mindrot.org/show_bug.cgi?id=1302
Summary: scp failes to copy a file with newline
Product: Portable OpenSSH
Version: 4.3p2
Platform: ix86
OS/Version: Linux
Status: NEW
Severity: minor
Priority: P2
Component: scp
AssignedTo: bitbucket at mindrot.org
ReportedBy: zdenek at pytela.net
When copying a directory (scp -r) with a file containing \n
copying stops with cryptic message
protocol error: expected control record
Debug mode is more verbose about the cause:
Sink: : skipping, filename contains a newline
protocol error: expected control record
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
...
debug1: Exit status 1
First, newline is legal (although weird) character for a file. Second,
the message doesn't help to user find what happened. Third, the copying
is not skipping one file, but stops at all.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
bugzilla-daemon at mindrot.org
2007-Apr-04 11:26 UTC
[Bug 1302] scp failes to copy a file with newline
http://bugzilla.mindrot.org/show_bug.cgi?id=1302 ------- Comment #1 from dtucker at zip.com.au 2007-04-04 21:26 ------- This is basically an unfixable limitation of the scp protocol. The header pretty much just "filename size modes\n" and when the filename has a newline in it the protocol breaks. You could escape the newlines (which I think I have a patch for somewhere) but then the complaint becomes "scp changed my filename". About the best that could be done is to bail or skip the file with a "don't do that, then" error when someone tries to copy a file with a newline embedded in the name. ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.