delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/03/30/15:08:09

X-Spam-Check-By: sourceware.org
Date: Thu, 30 Mar 2006 22:07:57 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: problems with gawk 3.1.5-3 hanging -- more info
Message-ID: <20060330200757.GO20907@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <442C25D0 DOT 7030605 AT pondol DOT com> <442C3197 DOT 7090309 AT pondol DOT com>
Mime-Version: 1.0
In-Reply-To: <442C3197.7090309@pondol.com>
User-Agent: Mutt/1.4.2i
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Mar 30 13:29, David Carter wrote:
> I've taken a look at the differences between -2 and -3; here's the diff:
> 
> $ diff -r gawk-3.1.5-2 gawk-3.1.5-3
> diff -r gawk-3.1.5-2/posix/gawkmisc.c gawk-3.1.5-3/posix/gawkmisc.c
> 223a224
> >#include <stdio.h>
> 237a239,244
> >
> >void
> >cygwin_premain2 (int argc, char **argv, struct per_process *myself)
> >{
> >  setmode (fileno (stdin), O_TEXT);
> >}
> 
> ...that's the only difference between the two source trees.
> 
> Not having looked at cygwin-specific source before, I'm going to guess
> that cygwin_premain2 is a hook which is called at program execution
> time, since there is no call to cygwin_premain2 in the source code.
> 
> I think the problem is the O_TEXT. If I change this to O_BINARY and
> recompile, everything works swimmingly. The question now is: should the
> file really be opened as O_TEXT, or as O_BINARY?
> 
> Can anyone set me straight on this?

O_TEXT is correct because gawk is a text tool in the first place and
it should treat input lines identical, regardless if they have DOS
or UNIX lineendings.

I can't tell why it fails for you, because I can't reproduce this
locally.  As for the O_BINARY mode, in theory there's a way to
accomplish that without rebuilding gawk by setting the BINMODE
variable:

  gawk -v BINMODE=r [...]

Unfortunately it turns out that this doesn't work because gawk fails
to call the setmode function in this case on Cygwin.  I'll upload a
patched gawk soon.  If you want to apply it by yourself, try this:


--- posix/gawkmisc.c.ORIG       2006-03-30 22:06:37.429941500 +0200
+++ posix/gawkmisc.c    2006-03-30 21:58:33.918902700 +0200
@@ -207,6 +207,9 @@ int
 os_setbinmode(fd, mode)
 int fd, mode;
 {
+#ifdef __CYGWIN__
+	setmode (fd, mode);
+#endif
 	return 0;
 }


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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