Message-ID: <3EB8F9A6.4050307@lml.ls.fi.upm.es> Date: Wed, 07 May 2003 14:18:46 +0200 From: Manuel Collado 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> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 138.100.10.20 X-Trace: 7 May 2003 14:16:07 +0100, 138.100.10.20 Lines: 75 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: >>[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 >>----------------------- > > > You are using the quote characters inside quoted strings; DOS/Windows > shells do not cope well with these. I suggest to try these commands > instead: > > gawk 'BEGIN {printf(\"================first\")}'> out.txt > gawk 'BEGIN {printf(\"++++second+\");}'>> out.txt > > That is, use single quotes instead of double quotes for the outer > quotes. That should work in either shell. No, the bug has been found by executing awk scripts stored in files. The example shown is only a minimal script to exercise the bug. BTW, it seems that the 'cmd.exe' shell of WinNT 4.0 handles doubles quotes correctly in the given example. > > >>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 > > > I have no idea why the older Gawk worked. Perhaps you use a non-DJGPP > port of that version, or maybe the DJGPP startup code that deals with > quotes has changed between the two ports. I'm using the previous and latest DJGPP gawk versions supplied in the distribution archives 'gwk306b.zip' and 'gwk311b.zip'. As said before, it is not a question of interpreting quotes in command lines. 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. To diagnose if this is a bug, could anybody either reproduce the bug or successfully append gawk output to a file? Thanks, -- To reply by e-mail, please remove the extra dot in the given address: m.collado -> mcollado