On Fri, Apr 13, 2007 at 09:37:14AM -0400, stuart van Zee wrote: > > I was under the impression that when using SFTP to transfer files they > were automatically treated as Binary files.
i might totally be wrong, but i had the impression that sftp doesn't incorporate the 'legacy ftp' concept of 'binary' vs. 'ascii', but rather just transferred files without any regard to what they have in them. > 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. have you tried scp instead of sftp? (if that is an option). sftp seems to be a bit of the bastard child of the openssh software family. > Now, when I use SFTP > the files just have the LF. that seems strange. i haven't used sftp nearly as much as scp, but i don't recall either ever having modified a file on me. i tried the following test: - made a test file (5 lines) using windows notepad, saved it to the openbsd box via a samba share. - opened up in vi and saw that it had '^M's at the end of it, quit out. - scp'd that file to another host on the network here - went to the other host, verified MD5s same - back on original host, sftp'd the file off of the remote host down to a new filename on the local host, verified MD5s the same. so in my case, sftp'ing a file from a remote host down locally didn't incur any CRLF->LF translation. maybe you are seeing a behaviour from something else and it just seems to be because of sftp(1) ? do you know for certain that the files, as they exist on the vendor's end, do indeed still have the CRLFs in them? > 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). might not need to go that far. if you know/trust that they have CRLFs on their end, but when you get the files from them, they have only LFs now, just test stuff on your end with your own remote sftp/ssh server like i did above. if you have a file that you know has CRLFs, and on this one "problem" host you can pull the file down over sftp from your remote test host, and it still has the CRLFs, that would seem to imply that your local system is not responsible for the translation. -- jared

