X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: From: Jay To: Subject: RE: flex: exec failed? Date: Mon, 4 Aug 2008 10:16:25 +0000 Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id m74AHDEx024938 No longer a Cygwin issue (repros on Linux), but here's why if anyone interested: #include #include int main() { signal(SIGPIPE, SIG_IGN); << Python putenv("M4=foo"); system("flex 1.l"); return 0; } Without ignoring sigpipe, flex dies reading the pipe of a failed-to-exec child, before it gets around to unlink("lex.yy.c"). If you put instrumentation (printf) in the fgets/fputs loop in filter_tee_header in flex, you find the sh variant stops without exiting the loop, whereas the python variant continues on, and deletes lex.yy.c. I'll patch my gmp/configure to not set M4 like this. I've reported this to gcc and gmp (gcc hits this because it configures gmp with cpu=none; usually building gmp sets M4=m4, which is "ok", though it really it should leave it alone.). - Jay > From: jayk123 AT hotmail DOT com > To: cygwin AT sourceware DOT org > Subject: RE: flex: exec failed? > Date: Thu, 31 Jul 2008 12:45:45 +0000 > > > Ok, it works the same on Cygwin and Linux/x86, but Python/NTAMD64 works. > Somehow Python/Posix related, portably. > > For anyone interested: > > $ echo %%> conftest.l > $ echo %%>> conftest.l > $ rm lex.yy.c > $ export M4=foo > $ flex conftest.l > flex: fatal internal error, exec failed > lex.yy.c exists > > $ rm lex.yy.c > $ python -c "import os; os.system(\"flex conftest.l\")" > flex: fatal internal error, exec failed > flex: 2 error writing output file lex.yy.c (I added the "2" to disambiguate 4 identical error messages) > lex.yy.c does not exists -- make configure-gmp fails > > relevant code in flex: > > filter_tee_header: > if ((to_cfd = dup (1)) == -1) > flexfatal (_("dup(1) failed")); > to_c = fdopen (to_cfd, "w"); > ... > fflush (to_c); > if (ferror (to_c)) > lerrsf (_("2 error writing output file %s"), > outfilename ? outfilename : ""); > > else if (fclose (to_c)) > lerrsf (_("error closing output file %s"), > outfilename ? outfilename : ""); > > while (wait (0)> 0) ; > > > again, I added the "2". > > Digging deeper... > > - Jay > > > [snip snip snip] -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/