php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78750 configure assumes yacc and re2c work
Submitted: 2019-10-25 03:13 UTC Modified: 2020-06-07 19:56 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: php-bugs-2019 at ryandesign dot com Assigned:
Status: Closed Package: *Compile Issues
PHP Version: 7.4.0RC4 OS: macOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php-bugs-2019 at ryandesign dot com
New email:
PHP Version: OS:

 

 [2019-10-25 03:13 UTC] 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]


Patches

bison-re2c-version.patch (last revision 2020-01-13 21:57 UTC by php-bugs-2019 at ryandesign dot com)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-31 10:40 UTC] nikic@php.net
-Assigned To: +Assigned To: petk
 [2019-10-31 10:40 UTC] nikic@php.net
@petk: Can you take a look at this?
 [2020-01-13 21:57 UTC] 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
 [2020-06-07 19:55 UTC] 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-06-07 19:56 UTC] petk@php.net
-Status: Assigned +Status: Open -Assigned To: petk +Assigned To:
 [2020-06-08 22:46 UTC] girgias@php.net
Automatic comment on behalf of peterkokot@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fe2afef36fc78c267133ddd403f48e0ee799efbc
Log: Fix #78750: configure assumes yacc and re2c work
 [2020-06-08 22:46 UTC] girgias@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 04 09:01:25 2020 UTC