Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3AB14F6C.E15E2D61@dot21rts.com> Date: Thu, 15 Mar 2001 18:25:33 -0500 From: Andy Helten X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: cygwin AT cygwin DOT com, "Larry Hall (RFK Partners, Inc)" Subject: Shell's "eval" doesn't behave when running a non-cygwin compiler Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, I've posted this problem to this newgroup a couple times (first without an strace listing and then with an strace listing), under the subject: "VxWorks' GNU cross-compiler in the Cygwin environment". However, I have only gotten one response and was hoping if I simplified the problem scenario and changed the "Subject:" line, it might be more appealing to look at. The following simple shell script can be used to produce the problem: #!/bin/sh rm -f conftest ac_link="c++ppc -nostdlib -nostdinc -c -o conftest conftest.cpp" if { (eval echo \"$ac_link\"); (eval $ac_link); } then echo "Compile succeeded (or did it?)" else echo "Compile failed!" fi if test -s conftest; then echo "1. The output is available!" else echo "1. The output is NOT available!" fi sleep 2 if test -s conftest; then echo "2. The output is available!" else echo "2. The output is NOT available!" fi If I run the above shell script using 'bash' or 'sh', I get the following output: c++ppc -nostdlib -nostdinc -c -o conftest conftest.cpp Compile succeeded (or did it?) 1. The output is NOT available! 2. The output is available! Also, I have found a work around using the following perl script: #!/usr/bin/perl eval `c++ppc @ARGV`; Apparently, Perl's "eval" waits for the compiler to finish before continuing and 'sh' waits for the cygwin perl to finish, so this at least serializes things. So the output from the shell script when using the perl script as the "compiler" is what you would expect: c++ppc_cygwin_workaround -nostdlib -nostdinc -c -o conftest conftest.cpp Compile succeeded (or did it?) 1. The output is available! 2. The output is available! However, the downside is that I don't get the return value from the compiler. So if a compile fails, it does not stop the build. The question I have: can cygwin 'sh' or 'bash' be used to spawn non-cygwin utilities (compilers)? From my experience, the answer is NO. Is it even possible to get 'sh' to recognize and wait for a non-cygwin process spawned by 'eval'? Could someone please answer these questions? I can provide an strace of the above situation if anyone wants it. And yes, I would be willing to at least look at the problem, but first would like someone to at least acknowledge this is problem and/or classify this behavior (normal/not normal/user error). OR, if there is another Bourne compatible shell that works with the cygwin environment could someone point me to it? Thanks, Andy -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple