X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f From: "Juan Manuel Guerrero" Organization: Darmstadt University of Technology To: djgpp-workers AT delorie DOT com Date: Tue, 23 Nov 2004 22:05:32 +0200 MIME-Version: 1.0 Subject: Re: djgpp 2.04 crash in libc.a CC: fdonahoe AT wilkes DOT edu Message-ID: <41A3B42C.13442.487E0B7@localhost> In-reply-to: <1101217013.41a33cf513618@webmail.wilkes.edu> X-mailer: Pegasus Mail for Windows (v4.02a, DE v4.02 R1) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-TUD-HRZ-MailScanner: Found to be clean X-TUD-HRZ-MailScanner-SpamCheck: Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk I have investigated this issue and tested on: 1) Win98SE with djdev203 and djdev204 2) Win2K (no WinXP) with djdev204 3) linux djdev204 means djgpp.cvs.tar.gz from 2004-11-22 compiled with gcc343 and bin215. The test that fails in sed's testsuite is the "eval" test. This test tests a new gnu specific sed command called "e". This new command is a script command that allows to write a command line that will call a program like perl or echo or something else from inside the sed script and replace that command line with the output of the called command. Example: s,qwertz,sed -f script.sed foo.txt, In this example the string "qwertz" will be replaced with the output of the sed program that will aply the sed script "script.sed" to the file "foo.txt". 1) Win98SE The e-command is implemented via popen/pclose. Here is a part of the offending test script that *will* work: [snip] #Try eval command /cpu/!b2 e../sed/sed 1q eval.in2 [snip] As can be seen, the newly build sed program located in the ../sed subdir will be invoked to print the first line of the file eval.in2. That output will be inserted in the output produced by the sed program under test. This command line works with sed program produced with djdev203, bin215 and gcc343. Here is a part of the offending test script that will *not* work: [snip] #Try eval option s,.* *cpu *,../sed/sed 1q eval.in2; echo "&",e [snip] As can be seen, here the first part of the regular expresion shall be substituted with the result of the compound command line: ../sed/sed 1q eval.in2; echo "cpu" As soon as sed uses popen with this command line the following error messages are produced: d:/_projekt/sed/sed-41.2/sed/sed.exe: can't read eval.in2;: No such file or directory (ENOENT) d:/_projekt/sed/sed-41.2/sed/sed.exe: can't read echo: No such file or directory (ENOENT) d:/_projekt/sed/sed-41.2/sed/sed.exe: can't read cpu: No such file or directory (ENOENT) The popen command fails, but it does not return a NULL pointer. Due to this fact, sed simply continues operation with an empty file which causes no harm and the testsuite is successfully finished and the naive user does not notice that something is wrong. Again the sed program has been produced with djdev203, bin215 and gcc343. Now I have replaced djdev203 with the djgpp.cvs.tar.gz sources from 2004-11-22. These sources have been compiled with gcc343b and bin215. I have reconfigured and recompiled the sed sources from scratch and run the testsuite. This time the testsuite already fails with the command: [snip] #Try eval command /cpu/!b2 e../sed/sed 1q eval.in2 [snip] This command worked with djdev203 ok but does not longer work with djdev204. If popen is invoked with the above command string it returns a NULL pointer and sed exits with and error message like: d:/_projekt/sed/sed-41.2/sed/sed.exe: error in subprocess making the testsuite fail in a controlled fashion. I had not he time to check the 2.04 popen and system sources for differences with the 2.03 sources. 2) Win2K I have reconfigured and recompiled the sources sed412s.zip using djgpp.cvs.tar.gz with bin215 and gcc343. The testsuite fails in exactly the same way as described in the case of Win98SE + djdev204. 3) Linux I have taken the djgpp port of sed 4.1.2 and configured and compiled it on linux. I tell this to make clear that there is nothing djgpp specific in the sed code to handle the pipe, so nothing has been broken by me. Them I run the testsuite and everything went ok. On linux, I have used gdb to run the "eval" test alone. The result is that neither the first nor the second test fails. I am not really familiar with the posix specifications about popen and system but it seems to be that posix has no difficulty in running a command where the programs has options like: ../sed/sed 1q eval.in2 or compound commands like: ../sed/sed 1q eval.in2; echo "cpu" Please note that I have not followed the developement of djgpp's implementations of popen and system commands, so I can only describe what I am seeing when I run the testsuite under different conditions, but it seems to become clear that something does not work as is should in the djdev204 implementation of popen and/or system. The same applies to some extend to djdev203 where multiple commands separated by semicolon can not be passed to popen and system. Anyway, until this has not been fixed for djgpp, I will release a new sed 4.1.2 package with the e-command disabled. Regards, Juan M. Guerrero