This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ASCII and BINARY files. Why?


Barry Fishman wrote:
> 
> Now back to the ASCII/BINARY discussion.  I think we need to follow
> the principle of least astonishment.  When one opens a file and
> sees ^M 's at the end of each line, you can tell right away what is
> going on.

You may be able to tell, but software can't.

Consider, for example, the surprise you get when doing a `diff' on a
gnu-win32 file after you've changed one line using a Windows editor.

Consider, for example the suprises that this sort of problem will
lead to when using tools like CVS.

> What is difficult is having to spend hours patching each application to
> to get around unexpected problems with seek addresses and files that
> don't match their expected sizes.

That is indeed difficult, but you must bear in mind that *whichever*
approach we adopt, there will probably be some difficulties.  We're
just trying to find the minimum-difficulty approach.  A zero-difficulty
solution seems impossible.

Not every application relies on file sizes or seek offsets being
related to number of characters read.  Most of those that do rely on
this do it only for binary files, and so patching them is a simple
matter of changing the calls to `fopen' or `open' to open the file
in binary mode.

The only ones that cause significant difficulty are those applications
that rely on file sizes or seek offsets being related to number of
characters read *for text files* (e.g. ~/.bash_history).
I don't think there are many such applications, are there?

-- 
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]