From mint-bounce@lists.fishpool.fi  Tue Jan 22 17:33:22 2008
X-Original-To: fnaumann@mail.boerde.de
Delivered-To: fnaumann@mail.boerde.de
Subject: Re: [MiNT] stdio write problem in mintlib
From: Alan Hourihane <alanh@fairlite.demon.co.uk>
To: Vincent =?ISO-8859-1?Q?Rivi=E8re?= <vincent.riviere@freesbee.fr>
Cc: mint@fishpool.com
In-Reply-To: <47871D3A.4090507@freesbee.fr>
References: <20071230010610.GA29673@fairlite.demon.co.uk>
	 <47775FEF.5060708@freesbee.fr>
	 <20071230102935.GB32676@fairlite.demon.co.uk>
	 <20071230142950.GA1737@fairlite.demon.co.uk> <4777C310.40504@freesbee.fr>
	 <20071230170400.GA3566@fairlite.demon.co.uk> <4777E309.8060709@freesbee.fr>
	 <20071230233428.GA10231@fairlite.demon.co.uk>
	 <478686D1.2010208@freesbee.fr>  <47871D3A.4090507@freesbee.fr>
Content-Type: text/plain; charset=UTF-8
Date: Fri, 11 Jan 2008 08:07:14 +0000
Message-Id: <1200038834.16968.12.camel@localhost>
Mime-Version: 1.0
X-Mailer: Evolution 2.12.1 
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-To: mint-bounce@lists.fishpool.fi
X-original-sender: alanh@fairlite.demon.co.uk
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>
X-Virus-Scanned: by amavisd-new at relay.boerde.de
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on relay.boerde.de
X-Spam-Status: No, hits=-1.0 tagged_above=-50.5 required=7.0 tests=AWL,
 BAYES_00
X-Spam-Level: 
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by freemint id m0MGP1eA004618
Status: 
X-Status: 
X-Keywords:                   

On Fri, 2008-01-11 at 08:39 +0100, Vincent Rivière wrote:
> My latest patch made the MiNTLib act as Cygwin regarding to the mode:
> 
> > - default mode (text or binary, according to UNIXMODE) must be only used 
> > for regular files
> > - binmode must be used in all the other cases (including pipes)
> 
> This is good because arbitrary binary data can be used in pipes (like in 
>   UNIX), and regular files are always written in the mode requested by 
> the user (according to UNIXMODE). Furthermore, software that is know to 
> work on Cygwin (regarding to textmode in stdio) will work as well with 
> the MiNTLib.
> 
> These rules work well as long as everyone respects it.
> Unfortunately, this is not the case for existing MiNT software.
> - Plain TOS programs always use stdout in textmode (including pipes)
> - Current MiNTLib programs always use stdout in default mode (including 
> pipes)
> 
> So if an old program is piped into a newly patched MiNTLib proram, the 
> new program will not work correctly, because it will find trailing CRs 
> in stdin and will not discard them.
> 
> In order to be compatible with the existing programs, the best solution 
> would probably to not patch anything. In that case the pipes use default 
> mode, so it is impossible to use real binary data in pipes when UNIXMODE 
>   is not set to b (is it a real problem ?). And UNIX software will have 
> to be patched explicitly for MiNT in order to be prepared to find CR in 
> pipes (like bash with the ` ` syntax).

With limited people on FreeMiNT development anyway, I think we don't
have the resources to patch all UNIX software explicitly for MiNT.

So I'd rather correct this now and just recompile the programs that are
broken.

I think if you have a new application compiled with new MiNTlib you
should compile your other applications with new MiNTlib too.

Alan.


