delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/03/31/00:03:00

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 AT byu DOT net>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: problems with gawk 3.1.5-3 hanging -- more info
References: <442C25D0 DOT 7030605 AT pondol DOT com> <442C3197 DOT 7090309 AT pondol DOT com> <20060330200757 DOT GO20907 AT calimero DOT vinschen DOT de> <442C408B DOT 3080409 AT carter DOT to>
In-Reply-To: <442C408B.3080409@carter.to>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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 AT byu DOT 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/

- Raw text -


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