Subject: Re: ftp client corrupts binary files with ^m ??
From: [email-masked] (Peter Dalgaard BSA)

8 Aug 1998 00:05:41 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
To: Larry Hall <[email-masked]>
Cc: "Kevin F. Quinn" <[email-masked]>, [email-masked],
        Guido Roeskens <[email-masked]>

Larry Hall <[email-masked]> writes:

> 
> At 09:00 AM 8/6/98 +0100, Kevin F. Quinn wrote:
> >Guido Roeskens [[email-masked]] wrote:
> >
> >> You have to change the transfer type to binary mode: Simply type
> >> "bin" as an abbreviation for "binary". You can check the transfer
> >> type set with "type" or with "status".
> >
> >The ftp.exe I have (from Sergey's "remote" package, I think) assumes
> >binary mounts, and fails on transfer of binary files to text!=binary
> >mounts in this way, even if type "binary" has been specified.
> >
> 
> I'm missing the logic of doing this.  If someone has already taken the
> time to modify the code to check that the file system is mounted binary
> and fail if it is not for binary transfers, why wouldn't one have just 
> made the changes that make sure the file is created locally as binary
> when the mode is specified as binary?  The problem should be simple to solve 
> if you're willing to edit and rebuild so I'm not sure I see the benefit of 
> not solving it if one was going to go through the edit/rebuild process 
> anyway (although anyone is free to do whatever they want with this code!)  
> Can anyone explain to me why it would be better to alter the ftp client to 
> do as Kevin describes above rather than just fix the problem?

As I understand it, it happens all by itself. The program opens the
file and writes bytes from the connection into it without touching
them. Then *cygwin* takes the written bytes and converts LF to CR-LF.
This happens every time you convert a Unix program that writes binary
data. You can fix it by opening the output file in binary mode
explicitly, whereever necessary (finding out where and when that is,
is the difficult part). 

The 'bin' mode of FTP has less to do with file modes than with the way
data passes across the wires: The opposite (ascii mode) means that
either end of the connection should convert to/from their native text
format to "net ascii" - lines of bytes separated by CR-LF as far as I
remember. 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([email-masked])             FAX: (+45) 35327907
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".