This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: problems with gawk 3.1.5-3 hanging -- more info

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

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   
volunteer cygwin coreutils maintainer
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


Unsubscribe info:
Problem reports:

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