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: 2019-10-31 10:40 UTC
From: php-bugs-2019 at ryandesign dot com Assigned: petk (profile)
Status: Assigned Package: *Compile Issues
PHP Version: 7.4.0RC4 OS: macOS
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Add a Patch

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?
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 15:01:28 2019 UTC