Ralf Fassel | 25 Jan 2010 20:16
Picon
Picon

msys 1.0.13 gawk problem

I'm using:
  msysCORE-1.0.13-1-msys-1.0.13-bin.tar.bz2 
  bash-3.1.17-2-msys-1.0.11-bin.tar.bz2 
  gawk-3.1.7-1-msys-1.0.11-bin.tar.bz2 

Extracted in some tmp directory, started msys.bat.

Problem is in gawk with printf, the positional parameters are printed
wrong:

Ok, as expected:
    $ echo -1 2 | gawk '{print $1, $2}'
    -1 2
    $  echo -1 2 | gawk '{printf "%d %d\n", $1, $2}'
    -1 2

Bug: wrong values printed (should be -1 2 in both cases):
    $  echo -1 2 | gawk '{printf "%g %g\n", $1, $2}'
    1 -2

    $  echo -1 2 | gawk '{printf "%f %f\n", $1, $2}'
    1.000000 -2.000000

    $ type gawk
    gawk is hashed (/bin/gawk)

    $ type echo
    echo is a shell builtin

    $ uname -a
(Continue reading)

Charles Wilson | 26 Jan 2010 04:17
Picon

Re: msys 1.0.13 gawk problem

Ralf Fassel wrote:
> Bug: wrong values printed (should be -1 2 in both cases):
>     $  echo -1 2 | gawk '{printf "%g %g\n", $1, $2}'
>     1 -2
> 
>     $  echo -1 2 | gawk '{printf "%f %f\n", $1, $2}'
>     1.000000 -2.000000

>     $ gawk --version
>     Use -h to see help about each section
>     GNU Awk 3.1.7
>     Copyright (C) 1989, 1991-2009 Free Software Foundation.
> 
> - Same awk version on linux doesn't have this problem.
> - Msys 1.0.11 doesn't have this problem.
> 
> Can anyone confirm this?

I can confirm the behavior on msys, but not that it works any
differently anywhere else:

msys:
$ uname -s -r
MINGW32_NT-6.0 1.0.13(0.47/3/2)
$ gawk --version
GNU Awk 3.1.7
$ echo "-1 2" | gawk '{printf "%f %f\n", $1, $2}'
-1.000000 2.000000

linux:
(Continue reading)

Ralf Fassel | 26 Jan 2010 10:24
Picon
Picon

Re: msys 1.0.13 gawk problem

* Charles Wilson
| msys:
| $ uname -s -r
| MINGW32_NT-6.0 1.0.13(0.47/3/2)
| $ gawk --version
| GNU Awk 3.1.7
| $ echo "-1 2" | gawk '{printf "%f %f\n", $1, $2}'
| -1.000000 2.000000

This is what I'd expect.

| I really wouldn't expect gawk's %f printf to act any differently
| that C's:
| 
| #include <stdio.h>
| int main(int argc, char *argv[])
| {
| 	double d1 = -1;
| 	double d2 = 2;
| 	printf ("%f %f\n", d1, d2);
| }
| 
| 
| $ gcc -o bob bob.c
| $ ./bob
| -1.000000 2.000000

In fact, it does not:

    $ gawk '{printf "%g %g\n", -1, 2}'
(Continue reading)

Charles Wilson | 26 Jan 2010 10:59
Picon

Re: msys 1.0.13 gawk problem

Ralf Fassel wrote:
> In fact, it does not:
> 
>     $ gawk '{printf "%g %g\n", -1, 2}'
> 
>     1 -2
> 
>     -1 2
> 
>     1 -2
> 
>     -1 2
> 
> Note the alternating sign...

Hmmm...this sounds disturbingly familiar.  See this thread:
http://thread.gmane.org/gmane.comp.gnu.mingw.devel/3592

> Will try to recompile the MSYS runtime...

Try compiling (the MSYS dll) with -fno-unit-at-a-time.  I think this
might be a compiler bug in the gcc used to build the msys dll.

--
Chuck

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
(Continue reading)

Ralf Fassel | 26 Jan 2010 20:04
Picon
Picon

Re: msys 1.0.13 gawk problem

* Charles Wilson
| Try compiling (the MSYS dll) with -fno-unit-at-a-time. I think this
| might be a compiler bug in the gcc used to build the msys dll.

Since setting CFLAGS in the environment did not make it into
libc/stdio/Makefile (where the printf's are), I added
-fno-unit-at-a-time manually there, and ran a recompile/reinstall:
problem gone.

Recompiled using the original Makefile:
problem reappeared.

So it seems like it really is a problem in the compiler.
How do I use -fno-unit-at-a-time everywhere?

R'

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Charles Wilson | 27 Jan 2010 02:30
Picon

Re: msys 1.0.13 gawk problem

Ralf Fassel wrote:
> I added
> -fno-unit-at-a-time manually there, and ran a recompile/reinstall:
> problem gone.
> 
> Recompiled using the original Makefile:
> problem reappeared.
> 
> So it seems like it really is a problem in the compiler.
> How do I use -fno-unit-at-a-time everywhere?

I can confirm this. Compiling the MSYS dll with unit-at-a-time enables
(the default for this version of gcc at levels -O2 and -O3), and you
will see this aberrant gawk behavior.  Compile with -fno-unit-at-a-time,
and gawk behaves as expected.

Note that this is with a gawk executable that was compiled last fall,
using msys-gcc-2.95.3 and (old) msys-binutils.

In answer to your question, Ralf, you should edit the msysrlsbld.ini
file and change the two lines:

-export CFLAGS="-O3 -g"
+export CFLAGS="-O3 -g -fno-unit-at-a-time"
 export LDFLAGS='-L/usr/lib/w32api'
-export CXXFLAGS="-O3 -g"
+export CXXFLAGS="-O3 -g -fno-unit-at-a-time"
 export CPPFLAGS='-I/usr/include/w32api'

Then, use ./msysrlsbld as usual.  (I'm assuming that you are trying to
(Continue reading)

Ralf Fassel | 27 Jan 2010 10:38
Picon
Picon

Re: msys 1.0.13 gawk problem

* Charles Wilson
| Note that this is with a gawk executable that was compiled last
| fall, using msys-gcc-2.95.3 and (old) msys-binutils.

I also see this behaviour with the simple C test program you posted
earlier which simply issues 4 printf's with fixed values in a row.
(gawk is just a victim here ;-)

| In answer to your question, Ralf, you should edit the msysrlsbld.ini
| file and change the two lines:

Ah, msysrlsbld.ini.  I forgot.

R'

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Trautenberg, Wolfgang | 29 Jan 2010 12:39
Picon

MSYS 1.0.12 and 1.0.13 core bin packages contain almost no executables!?

Greetings,
 
I am a happy MSYS user. We need to migrate to Windows 7. Since I run into some
obscure problems with MSYS 1.0.11 running on Windows 7, I checked, wether newer
versions of MSYS are available. On Sourceforge I found MSYS 1.0.12 and 1.0.13.
After some pain with the .lzma archives (I would not mind staying with the .tgz or .tar.gz archives)
I managed to unpack the content of  msysCORE-1.0.12-1-msys-1.0.12-bin.tar.lzma and
msysCORE-1.0.12-1-msys-1.0.13-bin.tar.lzma respectively.
 
After unpacking these files and trying to start MSYS via msys.bat, I realized msys would not
start as there is no rxvt.exe and no sh.exe in the MSYS bin directory.
 
Is it intentional, that these (and many other) executables are not  part of the MSYS 1.0.12 and
1.0.13 archives? Or are we not supposed to use these archives?
 
Any insight greatly appreciated!
 
regards
 
 Wolfgang
 
 
P.S.: The Windows 7 problem I am experiencing is:
 
         we start the msys sh from within an executable
         the sh executes a script
         the output of stdout and stderr of that script are redirected via tee to both the screen and a file
         ---
         executable.exe
            ...
            CreateProcess(.. , "c:/msys/bin/sh.exe -c my-script.sh   ,  ...)       // creates a process that is executed in console; the process executes the msys sh.exe  
         ----
       
         my-script.sh
            ...
            my-exe.exe 2>&1 | tee -a ./mylogfile.log
         ---
      
         When executing this, it works all right on Win2K through Vista, but crashes (brings up console Manager) on Windows 7
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mingw-msys mailing list
Mingw-msys@...
https://lists.sourceforge.net/lists/listinfo/mingw-msys
Charles Wilson | 29 Jan 2010 15:15
Picon

Re: MSYS 1.0.12 and 1.0.13 core bin packages contain almost no executables!?

Trautenberg, Wolfgang wrote:
> After some pain with the .lzma archives (I would not mind staying with
> the .tgz or .tar.gz archives)
> I managed to unpack the content of 
> msysCORE-1.0.12-1-msys-1.0.12-bin.tar.lzma and
> msysCORE-1.0.12-1-msys-1.0.13-bin.tar.lzma respectively.

We should relatively soon have an installer than can do this for you.
But for now, we provide the 'bsdtar' tool for unpacking them:
http://downloads.sourceforge.net/mingw/bsdtar-2.7.900a_r1628-20091110-mingw32-alpha-bin.zip

> After unpacking these files and trying to start MSYS via msys.bat, I
> realized msys would not
> start as there is no rxvt.exe and no sh.exe in the MSYS bin directory.
>  
> Is it intentional, that these (and many other) executables are not  part
> of the MSYS 1.0.12 and
> 1.0.13 archives? Or are we not supposed to use these archives?

It is deliberate. We have split the mingw and msys "giant" installation
packages into dozens of smaller components, so that each may be
individually updated more rapidly than once every three years.

Unfortunately, it's difficult to know which of these new smaller
packages you need to recreate the old "giant" installation.  The current
situation is obviously subpar; we'll try to improve it shortly.

--
Chuck

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

Gmane