This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: flex: exec failed?


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@hotmail.com
> To: cygwin@sourceware.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]