X-Spam-Check-By: sourceware.org
Message-ID: <442CB7F7.5060000@byu.net>
Date: Thu, 30 Mar 2006 22:02:47 -0700
From: Eric Blake <ebb9@byu.net>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: problems with gawk 3.1.5-3 hanging -- more info
References: <442C25D0.7030605@pondol.com> <442C3197.7090309@pondol.com> <20060330200757.GO20907@calimero.vinschen.de> <442C408B.3080409@carter.to>
In-Reply-To: <442C408B.3080409@carter.to>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to David Carter on 3/30/2006 1:33 PM:
> 
> Also, I took a look at some of the source for other utilites that work
> with text input; these included tail, head, cat, and sed. I don't see
> any of those utilities opening up the input file the way you are in
> gawk, and in fact a look at the ChangeLog for coreutils hints that they
> used setmode at one time and since removed it (why, I don't know).
> Comments abound like this in the ChangeLog:
> 
> ChangeLog:      * src/cat.c (main): Avoid setmode; use POSIX-specified
> routines instead.

The coreutils that use open() use the flags O_BINARY vs. O_TEXT to begin
with; and the coreutils that use FILE* use freopen(NULL, "rb", stdin) when
forcing standard in to be binary.  (The freopen idiom used a
coreutils-local patch to invoke a replacement rpl_freopen that called
setmode under the hood, but now that the latest cygwin snapshot supports
it directly, I will be updating coreutils to avoid my rpl_freopen
wrapper).  If there are any problems related to text-vs.-binary mode in
the coreutils, I am all ears, and can usually patch it pretty quickly
(witness the recent report about md5sum and text line endings in my 5.93-3
release).

Using cygwin_premain2 is great for a quick cygwin-only patch, but
sometimes it is nicer to have a solution that will be incorporated by
upstream maintainers using standard interfaces (well, O_BINARY is not
specified in SUSv3, but as a flag to standardized open that can easily be
#defined to 0 on non-text-mode platforms, it is easier to use than sucking
in the non-standardized <io.h> for setmode).  I don't think it should
matter which method the various cygwin packages use to handle text mode
issues, so long as their respective maintainers are willing to ensure
reasonable text-mode semantics on a per-package basis.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
volunteer cygwin coreutils maintainer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFELLf384KuGfSFAYARAtWFAKCNqE34TZIWRmWR9tt2eoWgNZxKmgCgv8nn
T5/Fy12nljPnxQLhTbZFZTc=
=ctzS
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

