delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/05/06/10:15:08

Message-ID: <3EB7C0D6.7030206@lml.ls.fi.upm.es>
Date: Tue, 06 May 2003 16:04:06 +0200
From: Manuel Collado <m DOT collado AT aaron DOT ls DOT fi DOT upm DOT es>
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: gawk 3.1.1: bug in stdout redirection on WinNT 4.0
NNTP-Posting-Host: 138.100.10.20
X-Trace: 6 May 2003 16:01:30 +0100, 138.100.10.20
Lines: 63
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Perhaps I've found a subtle bug in the DJGPP port of gawk 3.1.1:

The following commands correctly execute from a bash shell

F:\PRUEBAS\gawkbug>cat gawkbug
# Test gawk
gawk "BEGIN {printf(\"================first\")}"> out.txt
gawk "BEGIN {printf(\"++++second+\");}">> out.txt
echo -----------------------
cat out.txt
echo
echo -----------------------
gawk --version

F:\PRUEBAS\gawkbug>bash gawkbug
-----------------------
================first++++second+
-----------------------
GNU Awk 3.1.1
Copyright (C) 1989, 1991-2002 Free Software Foundation.
[snipped]

But the equivalent MS-DOS set of commands fail from a cmd shell

F:\PRUEBAS\gawkbug>cat gawkbug.bat
@echo off
gawk "BEGIN {printf(\"================first\")}"> out.txt
gawk "BEGIN {printf(\"++++second+\");}">> out.txt
echo -----------------------
type out.txt
echo.
echo -----------------------
gawk --version

F:\PRUEBAS\gawkbug>gawkbug
-----------------------
++++second+=====first
-----------------------
GNU Awk 3.1.1
Copyright (C) 1989, 1991-2002 Free Software Foundation.
[snipped]

It can be seen that the out.txt file is partially rewritten, instead of 
appended with the new text.

The weird thing is that the previous version of gawk doesn't suffers 
this malfunction:

F:\PRUEBAS\gawkbug>gawkbug
-----------------------
================first++++second+
-----------------------
GNU Awk 3.0.6
Copyright (C) 1989, 1991-2000 Free Software Foundation.
[snipped]

I'm running Windows NT 4.0 SP6. Other OSs not tested.

Any ideas? TIA
-- 
To reply by e-mail, please remove the extra dot
in the given address:  m.collado -> mcollado

- Raw text -


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