On Fri, 13 Apr 2007 09:37:14 -0400, stuart van Zee wrote:

>Sorry if this belongs elsewhere but I was sure someone here would know.
>
>I was under the impression that when using SFTP to transfer files they 
>were automatically treated as Binary files.  So if the remote file uses
>CRLF to terminate lines, the downloaded file would have CRLF terminating
>it's lines.  So I have a vendor that has replaced his FTP with SSH/SFTP.
>my code is written to expect CRLF because that is the way the files
>were when using the old FTP system to download.  Now, when I use SFTP
>the files just have the LF.  The vendors answer is that we need to use
>ASCII mode to transfer the files to get the CRLF.  I didn't know that 
>there WAS an ASCII mode in SFTP let alone that using ASCII as opposed to 
>Binary would change the line terminators.  The files in question are
>technically ASCII text files but shouldn't I be getting an EXACT copy of
>the file when I use Binary mode (assuming that I am right and that is
>indeed the default with SFTP)?
>
>What I really need is an explanation or a pointer to where I can get an
>explanation so that I really know what I am talking about when I talk
>to this vendor (and KNOW that I know what I am talking about).
>
>Stuart van Zee

I cannot duplicate your findings. maybe we need to know a bit more
about what is running at each end.

I did:
Make short file with CRLF at end of each line except last.
That used a windows text editor (UE).
Used winscp to send it to an OpenBSD box using sftp (you can choose
that or scp).
Note: Winscp does offer Text mode, Binary mode and Automatic.
I chose binary. Note that the conversion happens in winscp if you let
it do Text or Auto.
Then I used sftp on another OpenBSD box to get the file from the other
one.
All of the CRLF pairs were intact.

Conclusion: My theory is that the conversion happens at the "other
end".
Insufficient data to speculate further but the CR stripping does NOT
happen in OpenBSD's sftp.

HTH, HAND. More testing if you'd like to spec it. 

Rod/

A consultant is someone who's called in when someone has painted himself into a 
corner.  He's expected to levitate his client out of that corner.

-The Sayings of Chairman Morrow. 1984.

Reply via email to