Bug #78788 [PATCH]: ./configure generates invalid php_version.h
| From: | max@swk-web.com | Date: | Thu, 07 Nov 2019 07:15:03 +0000 |
| Subject: | Bug #78788 [PATCH]: ./configure generates invalid php_version.h | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223615@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78788&edit=1
ID: 78788
Patch added by: max@swk-web.com
Reported by: php at shyim dot de
Summary: ./configure generates invalid php_version.h
Status: Open
Type: Bug
Package: Compile Failure
Operating System: NixOs
PHP Version: 7.4.0RC5
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Escaping of $SED in the autotools configure script
On GitHub: https://github.com/php/php-src/pull/4891
Patch: https://github.com/php/php-src/pull/4891.patch
Previous Comments:
------------------------------------------------------------------------
[2019-11-06 17:11:17] max at swk-web dot com
Sorry I messed up the console output and sent the wrong output -.-
Here is the corrected one:
$ cat tmp.sh
#!/bin/bash
executable_sed=$(which sed)
relative_sed_location=$(realpath --relative-to="." "${executable_sed}")
relative_executable_sed=./${relative_sed_location}
echo ${executable_sed}
echo ${relative_sed_location}
echo ${relative_executable_sed}
version=7.4.0RC5
echo ${version} | ${executable_sed} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | ./${relative_sed_location} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
IFS="."
echo ${version} | ${executable_sed} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | ${relative_executable_sed} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo "${relative_executable_sed}"
echo ${relative_executable_sed}
echo ${version} | "${executable_sed}" 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | "${relative_executable_sed}" 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
$ ./tmp.sh
/usr/bin/sed
../../usr/bin/sed
./../../usr/bin/sed
7..4.0RC5
7..4.0RC5
7. 4 0RC5
./tmp.sh: Zeile 17: : Kommando nicht gefunden.
./../../usr/bin/sed
/ / /usr/bin/sed
7. 4 0RC5
7. 4 0RC5
------------------------------------------------------------------------
[2019-11-06 17:05:06] max at swk-web dot com
The problem seems to be some missing escaping when using relative paths, and changing the IFS to
".":
$ cat tmp.sh
#!/bin/bash
executable_sed=$(which sed)
relative_sed_location=$(realpath --relative-to="." "${executable_sed}")
relative_executable_sed=./${relative_sed_location}
echo ${executable_sed}
echo ${relative_sed_location}
echo ${relative_executable_sed}
version=7.4.0RC5
echo ${version} | ${sed_location} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | ./${relative_sed_location} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
IFS="."
echo ${version} | ${sed_location} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | ${relative_executable_sed} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo "${relative_executable_sed}"
echo ${relative_executable_sed}
echo ${version} | "${executable_sed}" 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | "${relative_executable_sed}" 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
$ ./tmp.sh
/usr/bin/sed
../../usr/bin/sed
./../../usr/bin/sed
./tmp.sh: Zeile 12: s/\([[0-9\.]]*\)\(.*\)/\1\.\2/: Datei oder Verzeichnis nicht gefunden
7..4.0RC5
./tmp.sh: Zeile 16: s/\([[0-9\.]]*\)\(.*\)/\1\.\2/: Datei oder Verzeichnis nicht gefunden
./tmp.sh: Zeile 17: : Kommando nicht gefunden.
./../../usr/bin/sed
/ / /usr/bin/sed
7. 4 0RC5
7. 4 0RC5
version=7.4.0RC5
echo ${version} | ${sed_location} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | ./${relative_sed_location} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
IFS="."
echo ${version} | ${sed_location} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | ${relative_executable_sed} 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo "${relative_executable_sed}"
echo ${relative_executable_sed}
echo ${version} | "${executable_sed}" 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
echo ${version} | "${relative_executable_sed}" 's/\([[0-9\.]]*\)\(.*\)/\1\.\2/'
------------------------------------------------------------------------
[2019-11-06 15:04:38] php at shyim dot de
I guess I have found the issue
checking for a sed that does not truncate output...
/nix/store/5bzp9gfa14j4a1rbxxf6d574a4qgmqi9-gnused-4.7/bin/sed
./configure: line 3832: /nix/store/5bzp9gfa14j4a1rbxxf6d574a4qgmqi9-gnused-4: No such file or
directory
Line 3842: set $(echo 7.4.0RC5 | $SED 's/\([0-9\.]*\)\(.*\)/\1\.\2/')
I have outputted the $SED it contains "/nix/store/5bzp9gfa14j4a1rbxxf6d574a4qgmqi9-gnused-4
7/bin/sed"
The dot is missing in path
------------------------------------------------------------------------
[2019-11-06 14:56:31] cmb@php.net
2.69 should be good.
------------------------------------------------------------------------
[2019-11-06 14:52:00] php at shyim dot de
autoconf --version
autoconf (GNU Autoconf) 2.69
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=78788
--
Edit this bug report at https://bugs.php.net/bug.php?id=78788&edit=1