delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/04/24/16:36:50

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
X-Authentication-Warning: hp2.xraylith.wisc.edu: khan owned process doing -bs
Date: Mon, 24 Apr 2000 16:36:58 -0500 (CDT)
From: Mumit Khan <khan AT NanoTech DOT Wisc DOT EDU>
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: hybrid text/binary mount
In-Reply-To: <20000424150424.A1421@cygnus.com>
Message-ID: <Pine.HPP.3.96.1000424163111.2818G-100000@hp2.xraylith.wisc.edu>
MIME-Version: 1.0

On Mon, 24 Apr 2000, Chris Faylor wrote:

> On Mon, Apr 24, 2000 at 02:31:19PM -0400, DJ Delorie wrote:
> >Hey, I've got an idea.  How about a mount mode where files opened for
> >reading do CR/LF conversion *if* they look like text files (i.e. no
> >binary characters, all CR/LF are part of CR/LF pair), and files open
> >for writing always write files in binary mode.
> 
> That's amazing.  I have been thinking about the same thing for several
> days.  I have started to type this in several time but always hit a wall
> when I realized that given the nature of this mailing list, either no one
> would respond or somewone will respond with a twenty page treatise on the
> way they think it should be done with no hint of an effort to volunteer to
> do the actual work.
> 
> I was thinking that if a file had any characters whose ASCII code was
> < ' ' or >= DEL before the first \n, then the file would be considered
> binary.  Otherwise, the file would be text.  You could apply this heuristic
> to both input and output.
> 
> This might catch a majority of the cases where people really want binary
> code but it is so non-deterministic that it might make problems harder
> to track down.
> 
> I was thinking of a CYGWIN=autobinmode and a mount '-a' option.


I have yet to read the whole thread, so apologies in advance if I'm
missing anything.

I implemented something along these lines for glibc2 win32 port, and 
it works well in theory, but ran into a whole bunch of weird problems. 
My main motivation was to support scripts written using native editors 
that use CR-LF line endings; writing is always binary, since there is
distinction made in the runtime between text vs binary streams, and
all streams are binary.

All was well, until someone who used a file that had innocent looking
text as the first line (eg., "This file cannot be run in MSDOS mode"), 
and the rest was binary, and of course the reader failed miserably. I 
believe I have two other bug reports from other testers that got bitten 
by something similar.

After this I had reverted the change, but now rethinking how to do this
right.

Regards,
Mumit


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019