Bug #78750 [Asn->Opn]: configure assumes yacc and re2c work
| From: | petk@php.net | Date: | Sun, 07 Jun 2020 19:56:26 +0000 |
| Subject: | Bug #78750 [Asn->Opn]: configure assumes yacc and re2c work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227351@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78750&edit=1
ID: 78750
Updated by: petk@php.net
Reported by: php-bugs-2019 at ryandesign dot com
Summary: configure assumes yacc and re2c work
-Status: Assigned
+Status: Open
Type: Bug
Package: *Compile Issues
Operating System: macOS
PHP Version: 7.4.0RC4
-Assigned To: petk
+Assigned To:
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2020-06-07 19:55:46] petk@php.net
The following pull request has been associated:
Patch Name: Fix #78750: configure assumes yacc and re2c work
On GitHub: https://github.com/php/php-src/pull/5681
Patch: https://github.com/php/php-src/pull/5681.patch
------------------------------------------------------------------------
[2020-01-13 21:57:31] php-bugs-2019 at ryandesign dot com
The following patch has been added/updated:
Patch Name: bison-re2c-version.patch
Revision: 1578952651
URL: https://bugs.php.net/patch-display.php?bug=78750&patch=bison-re2c-version.patch&revision=1578952651
------------------------------------------------------------------------
[2019-10-31 10:40:02] nikic@php.net
@petk: Can you take a look at this?
------------------------------------------------------------------------
[2019-10-25 03:13:33] php-bugs-2019 at ryandesign dot com
Description:
------------
The configure script was modified in PHP 7.4 to test for the bison and re2c version. But the code to
do so assumes that the program that it found responds to the --version flag and outputs a version
number. If the program is found (or if the user specifies which program to use with the YACC or RE2C
environment variables) but the output from the program is empty or doesn't include the version
number, then the configure script inadvertently outputs all of its variables and functions.
For years, with PHP 7.3.x and earlier, I've been configuring PHP with the environment variables
LEX=true RE2C=true YACC=true. I did this to ensure that the build system did not regenerate the
parsers, even if the right versions of lex, re2c or bison were installed; I could not find any other
way to tell the build system not to do that. Now, with PHP 7.4, that doesn't work anymore, or
maybe it does work, but it produces tons of undesired output in the process.
This is because the configure script runs
$YACC --version 2> /dev/null | grep 'GNU
Bison' | cut -d ' ' -f 4 | tr -d a-z, assigns that to the variable
php_bison_version, saves IFS, sets IFS to ".", and runs set
$php_bison_version. If $php_bison_version is not empty, this sets the positional parameters.
But if $php_bison_version is empty, it outputs all variables and functions. And similarly with
$RE2C.
https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
> If no options or arguments are supplied, set displays the names and values of all
> shell variables and functions
Test script:
---------------
YACC=true ./configure
Expected result:
----------------
[snip]
checking for bison... true
checking for bison version... unknown
[snip]
Actual result:
--------------
[snip]
checking for bison... true
checking for bison version... AWK=gawk
BASH=/bin/sh
BASH_ARGC=([0]="1")
BASH_ARGV=([0]="--no-reexec")
BASH_LINENO=([0]="0")
BASH_SOURCE=([0]="./configure")
BASH_VERSINFO=([0]="3" [1]="2" [2]="57" [3]="1"
[4]="release" [5]="x86_64-apple-darwin17")
BASH_VERSION='3.2.57(1)-release'
CC=cc
CFLAGS='-g -O2'
COLORFGBG='15;0'
COLORTERM=truecolor
CONFIGURE_ARGS=
CONFIGURE_COMMAND=' '\''./configure'\'' '
[snip]
val=
var=CXX
verbose=
x_includes=NONE
x_libraries=NONE
expr: not a decimal number: 'dummy'
[snip]
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78750&edit=1