bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MSYS gawk treats all input files as binary


From: Aharon Robbins
Subject: Re: MSYS gawk treats all input files as binary
Date: Thu, 12 Nov 2009 20:42:21 +0200

Hi.

Re the below, wouldn't it be easier to just revise the gawk doc to say
that on MSYS it uses binary mode?

I have never heard of the "t" modifier in the fopen mode parameter and
don't think it's very standard.  Nor do I really want yet another ifdef...

If you want to supply a patch for the binmode function in pc/gawkmisc.pc
that does the right thing for MSYS, I would consider including it.

Thanks,

Arnold

> From: Adam Strzelecki <address@hidden>
> Subject: MSYS gawk treats all input files as binary
> Date: Mon, 9 Nov 2009 17:21:05 +0100
> To: address@hidden
>
> Hello,
>
> I have absolutely no idea whether it should be fixed in GAWK itself or  
> MSYS, but GAWK docs state that GAWK uses textmode on Windows unless  
> BINMODE is explicitly set to use binary.
> This is achieved in io.c line 239 binmode function that adds "b" when  
> BINMODE is specified, and leaves mode untouched otherwise.
>
> This works fine when using msvcrt.dll, where fopen(..., "r") means use  
> default mode (which is textmode). However on MSYS fopen(..., "r")  
> means use virtual mount mode (which are binary by default for all of  
> them). So I think GAWK should always force text mode in Windows with  
> fopen(..., "rt") rather than leave CRT to decide.
>
> This is copy of my original report at:
> https://sourceforge.net/tracker/?func=detail&aid=2894666&group_id=2435&atid=102435
>
> As a result of this problem autoconf (using awk) on Windows produces  
> very annoying problem:
> https://sourceforge.net/tracker/?func=detail&aid=2894666&group_id=2435&atid=102435
>
> ---- CUT ----
> MSYS awk treats all input files specified as parameter as binary on  
> default
> MSYS installation.
>
> Regular gawk compiled on Windows without MSYS wrapper uses MS CRT
> fopen(...,"r") for all file reads unless BINMODE=r or BINMODE=rw (see  
> awk
> docs), if BINMORE is set then it calls fopen(...,"rb"). On Windows "r"
> means default mode (which is TEXT), "rb" means binary.
>
> However MSYS awk uses wrapped fopen where "r" means mount mode which is
> always BINARY (because all MSYS mounts are binary by default).
>
> So MSYS awk build should used some patched MSYS gawk io.c binmode  
> function
> (line 239) where "t" is explicitely specified, so "rt" instead of "r",  
> or
> "wt" instead of "w".
>
> uname -a
> --------------
> MINGW32_NT-5.1 VMONO 1.0.11(0.46/3/2) 2007-12-04 23:31 i686 Msys
>
> awk --version
> -------------------
> GNU Awk 3.1.7
> ---- CUT -----
>
> Best regards,
> -- 
> Adam Strzelecki




reply via email to

[Prev in Thread] Current Thread [Next in Thread]