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

Message-ID: <3EBA4A19.9090902@lml.ls.fi.upm.es>
Date: Thu, 08 May 2003 14:14:17 +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: Re: gawk 3.1.1: bug in stdout redirection on WinNT 4.0
References: <3EB7C0D6 DOT 7030206 AT lml DOT ls DOT fi DOT upm DOT es> <9003-Tue06May2003200634+0300-eliz AT elta DOT co DOT il> <3EB8F9A6 DOT 4050307 AT lml DOT ls DOT fi DOT upm DOT es> <2427-Wed07May2003165629+0300-eliz AT elta DOT co DOT il>
NNTP-Posting-Host: 138.100.10.20
X-Trace: 8 May 2003 14:11:38 +0100, 138.100.10.20
Lines: 78
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:
[snip]
> Then please show an example of this bug that doesn't use command-line
> argument quoting.

F:\PRUEBAS\gawkbug>cat bbbb
BEGIN { print "bbbb" }

F:\PRUEBAS\gawkbug>cat gawkbug.bat
@echo off
echo aaaaaaaaaaaaaaaaaaaaaaa > out.txt
gawk -f bbbb >> out.txt
echo -----------------------
type out.txt
echo -----------------------
gawk --version

F:\PRUEBAS\gawkbug>gawkbug
-----------------------
bbbb                            <======== overwritten
aaaaaaaaaaaaaaaaa
-----------------------
GNU Awk 3.1.1
Copyright (C) 1989, 1991-2002 Free Software Foundation....


F:\PRUEBAS\gawkbug>gawkbug
-----------------------
aaaaaaaaaaaaaaaaaaaaaaa
bbbb                            <======== appended
-----------------------
GNU Awk 3.0.6
Copyright (C) 1989, 1991-2000 Free Software Foundation....


> 
> 
>>Apparently it may be an issue related to how the externally redirected 
>>stdout handler is passed to gawk. And using bash or the native command 
>>shell makes a difference.
>>
>>For DJGPP gawk 3.1.1 on WinNT 4.0, what I find is that any redirection 
>>of the form
>>
>>     gawk ..... >> outfile
>>
>>always overwrites outfile from the beginning, but preserving the non 
>>overwritten contents.
> 
> 
> Redirection from the command line has nothing to do with Gawk (or any
> DJGPP program).  The redirection is done by the shell you are using,
> either Bash or CMD.EXE.  It's possible that CMD.EXE from NT4 has
> problems with redirection when it runs DOS programs (I think I've
> heard in the past a couple of reports along these lines, but I'm not
> sure).

Yes, this is what puzzles me. But the fact is that gawk 3.0.6 behaves 
correctly. And also other DJGPP ported utilities that write to stdout.

Thinking about possible causes, I'm considering the following possibilities:

- The ported gawk 3.1.1 code makes some test on the stdout handler and 
resets the file pointer in some circumstances.
- The same action is performed at the library level.

Before looking at the sources or further investigation, I would like to 
know if there is a way to know which library version has been used to 
build each particular version of gawk.

I could also try to rebuild gawk from the sources. But in that case I 
would like to use exactly the same library version.

Thanks for your time.
-- 
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