ID: 14958 Comment by: svensk_tosing at hotmail dot com Reported By: [EMAIL PROTECTED] Status: Closed Bug Type: Compile Failure Operating System: linux debian unstable PHP Version: 4.0CVS-2002-01-09 New Comment:
Quote from uClibc mailing-list: The problem is that php calls fflush() on the opened stream prior to the fread() call. According to ANSI/ISO C99, calling fflush() on a readonly or currently reading stream is _undefined_behavior_. In uClibc, I chose to set the stream's error indicator, set errno, and return failure. So, when php calls ferror() because fread() returned 0, it sees that the stream is in an error state and assumes it was the read that failed. (Thread http://www.uclibc.org/lists/uclibc/2003-June/006466.html ) Previous Comments: ------------------------------------------------------------------------ [2002-01-10 06:25:11] [EMAIL PROTECTED] Derick fixed it in CVS. ------------------------------------------------------------------------ [2002-01-10 06:04:28] [EMAIL PROTECTED] yep, it works with this additional line. ------------------------------------------------------------------------ [2002-01-09 21:00:27] [EMAIL PROTECTED] >From the error message I'ld say you just need to include <errno.h> in zend_ini_scanner.l (like in zend_language_scanner.l), can you verify this? ------------------------------------------------------------------------ [2002-01-09 19:57:14] [EMAIL PROTECTED] it seems, that since my debian unstable upgraded from flex 2.5.4a-14 to 2.5.4a-15, I can't compile the Zend Engine anymore. It throws an error in zend_ini_parser.c and if I compare a zend_ini_parser.c genearated with the -14 version and one from -15 version, there are indeed differences where the error occurs. here's the error-mesage from make: /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../main -DLINUX=22 -DUSE_HSREGEX -I../TSRM -g -Wall -prefer-pic -c zend_ini_scanner.c gcc -DHAVE_CONFIG_H -I. -I. -I../main -DLINUX=22 -DUSE_HSREGEX -I../TSRM -g -Wall -c zend_ini_scanner.c -fPIC -DPIC -o zend_ini_scanner.lo zend_ini_scanner.c: In function `ini_lex': zend_ini_scanner.c:826: warning: label `find_rule' defined but not used zend_ini_scanner.c: In function `yy_get_next_buffer': zend_ini_scanner.c:1243: `errno' undeclared (first use in this function) zend_ini_scanner.c:1243: (Each undeclared identifier is reported only once zend_ini_scanner.c:1243: for each function it appears in.) zend_ini_scanner.c:1243: `EINTR' undeclared (first use in this function) ./zend_ini_scanner.l: At top level: zend_ini_scanner.c:1900: warning: `yy_flex_realloc' defined but not used zend_ini_scanner.c:1350: warning: `yyunput' defined but not used make[1]: *** [zend_ini_scanner.lo] Error 1 make[1]: Leaving directory `/opt/cvs/php4/Zend' make: *** [all-recursive] Error 1 and here the diff between the both zend_ini_scanner.c versions: --- Z/zend_ini_scanner.c Thu Jan 10 01:28:37 2002 +++ Zend/zend_ini_scanner.c Thu Jan 10 01:52:57 2002 @@ -698,9 +698,17 @@ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } #endif and here the relevant part from the debian-changelog: flex (2.5.4a-15) unstable; urgency=low * if a signal is delivered while the parser is in the read routine (coded by flex), the result is flex reports and YY_FATAL_ERROR causing plan to exit. The race condition appears much more frequently than one might expect because plan spends a good deal of time in read routine while gcc is preparing the input. I cleaned up another problem case beyond what is given in the patch. closes: Bug#125611 I have no idea about this flex stuff, so maybe someone else out there can fix that :) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=14958&edit=1