php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78460 PEAR installation failure
Submitted: 2019-08-27 08:59 UTC Modified: 2019-08-28 02:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: l dot declercq at nuxwin dot com Assigned: petk (profile)
Status: Closed Package: *General Issues
PHP Version: 7.4.0beta4 OS: debian
Private report: No CVE-ID: None
 [2019-08-27 08:59 UTC] l dot declercq at nuxwin dot com
Description:
------------
The "$php_shtool mkdir -p pear/scripts" statement is not present in the configure.ac leading to PEAR installation failure.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-27 09:02 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2019-08-27 09:02 UTC] nikic@php.net
What did you do and what error did you get...?
 [2019-08-27 09:14 UTC] l dot declercq at nuxwin dot com
-Status: Feedback +Status: Open
 [2019-08-27 09:14 UTC] l dot declercq at nuxwin dot com
I've compiled PHP 7.4.0beta4 under Debian Stretch...


Relevant options I'm using to make you able to reproduce:

--disable-all
--with-pear


As I said, the  "$php_shtool mkdir -p pear/scripts" statement is missing in the configure.ac. In previous PHP version, for instance, 5.6.40, there was such statement in the configure.in


$php_shtool mkdir -p pear/scripts
$php_shtool mkdir -p scripts
$php_shtool mkdir -p scripts/man1

but now, only the two last remain.


So, PEAR environnent installation is failing. recipe install-pear failed, without further explaination.. I searched to figure out that the statement for directory creation inside the build directory was missing.
 [2019-08-27 09:32 UTC] nikic@php.net
I just did a build using --with-pear and got the following output:

Installing PEAR environment:      /home/nikic/php-install/lib/php/
--2019-08-27 11:29:23--  https://pear.php.net/install-pear-nozlib.phar
Resolving pear.php.net (pear.php.net)... 109.203.101.62
Connecting to pear.php.net (pear.php.net)|109.203.101.62|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3620797 (3,5M)
Saving to: ‘pear/install-pear-nozlib.phar’

install-pear-nozlib.phar 100%[==================================>]   3,45M  3,43MB/s    in 1,0s    

2019-08-27 11:29:24 (3,43 MB/s) - ‘pear/install-pear-nozlib.phar’ saved [3620797/3620797]

[PEAR] Archive_Tar    - installed: 1.4.7
[PEAR] Console_Getopt - installed: 1.4.2
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.4.3
[PEAR] PEAR           - installed: 1.10.9
Warning! a PEAR user config file already exists from a previous PEAR installation at '/home/nikic/.pearrc'. You may probably want to remove it.
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /home/nikic/php-install/lib/php to your php.ini include_path
[Tue Aug 27 11:29:25 2019]  Script:  '/home/nikic/php-7.4/pear/install-pear-nozlib.phar'
/home/nikic/php-7.4/Zend/zend_objects.c(196) :  Freeing 0x00007f8daac01000 (360 bytes), script=/home/nikic/php-7.4/pear/install-pear-nozlib.phar
=== Total 1 memory leaks detected ===
/home/nikic/php-7.4/build/shtool install -c ext/phar/phar.phar /home/nikic/php-install/bin
ln -s -f phar.phar /home/nikic/php-install/bin/phar
Installing PDO headers:           /home/nikic/php-install/include/php/ext/pdo/

While that memory leak warning is concerning, I don't get an outright installation failure.
 [2019-08-27 09:43 UTC] l dot declercq at nuxwin dot com
Surely because this is not the 7.0.4beta4 version but a git version... In the "released" 7.0.4beta4, the pear/install-pear-nozlib.phar archive is already there while this is not the case for your git version ;) That not really the same context ;)
 [2019-08-27 09:49 UTC] l dot declercq at nuxwin dot com
I'll do a new check by doing the build first, then remove the pear/install-pear-nozlib.phar archive and ran the install recipe.
 [2019-08-27 09:56 UTC] l dot declercq at nuxwin dot com
Confirmed. So basically put, the 7.0.4beta4 comes with pear/install-pear-nozlib.phar archive (not present in git repository). In such case, the installation fail because the pear directory isn't pre-created in build directory (statement missing in the configure.ac, and which was present in previous PHP versions such as 5.6.40).

If I build, then remove the pear/install-pear-nozlib.phar archive and ran the install recipe. I get:

Installing PHP CLI binary:        /opt/phpswitcher/20190827/php7.4/bin/
Installing PHP FPM binary:        /opt/phpswitcher/20190827/php7.4/sbin/
Installing build environment:     /opt/phpswitcher/20190827/php7.4/lib/php/build/
Installing PHP CGI binary:        /opt/phpswitcher/20190827/php7.4/bin/
Installing shared extensions:     /opt/phpswitcher/20190827/php7.4/lib/php/20190529/
Installing PHP CGI man page:      /opt/phpswitcher/20190827/php7.4/share/man/man1/
Installing PHP CLI man page:      /opt/phpswitcher/20190827/php7.4/share/man/man1/
Installing helper programs:       /opt/phpswitcher/20190827/php7.4/bin/
Installing PEAR environment:      /opt/phpswitcher/20190827/php7.4/share/pear/
  program: phpize
Installing PHP FPM defconfig:     skipping
Installing PHP FPM man page:      /opt/phpswitcher/20190827/php7.4/share/man/man8/
  program: php-config
Installing PHP FPM status page:   /opt/phpswitcher/20190827/php7.4/share/php/fpm/
/usr/local/src/phpswitcher/php-7.4.0beta4/build/shtool install -c ext/phar/phar.phar /opt/phpswitcher/20190827/php7.4/bin
Installing man pages:             /opt/phpswitcher/20190827/php7.4/share/man/man1/
  page: phpize.1
ln -s -f phar.phar /opt/phpswitcher/20190827/php7.4/bin/phar
Installing PDO headers:           /opt/phpswitcher/20190827/php7.4/include/php/ext/pdo/
  page: php-config.1
Installing header files:          /opt/phpswitcher/20190827/php7.4/include/php/
make[2] : on entre dans le répertoire « /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build »

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build/pear/install-pear-nozlib.phar on line 1271

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/index.php on line 15

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/index.php on line 16

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Installer.php on line 22

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Installer.php on line 23

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Downloader.php on line 22

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Common.php on line 22

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Common.php on line 837

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Config.php on line 20

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Config.php on line 21

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Registry.php on line 21

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Registry.php on line 22

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/DependencyDB.php on line 20

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/DependencyDB.php on line 21

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Config.php on line 22

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Installer/Role.php on line 19

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Installer/Role.php on line 20

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Config.php on line 23

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/System.php on line 19

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/System.php on line 20

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/Console/Getopt.php on line 21

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Common.php on line 838

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 19

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Validate.php on line 24

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Validate.php on line 25

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Validator/PECL.php on line 18

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Downloader.php on line 23

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/index.php on line 17

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/index.php on line 18

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/index.php on line 19

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/index.php on line 20

Notice: Trying to access array offset on value of type null in /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build/pear/install-pear-nozlib.phar on line 961

Notice: Trying to access array offset on value of type null in /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build/pear/install-pear-nozlib.phar on line 962

Notice: Trying to access array offset on value of type null in /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build/pear/install-pear-nozlib.phar on line 963

Notice: Trying to access array offset on value of type null in /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build/pear/install-pear-nozlib.phar on line 964

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Frontend.php on line 83

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Frontend/CLI.php on line 19

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 304

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile/Parser/v2.php on line 18

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile/Parser/v2.php on line 19

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile/v2.php on line 18

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile/v2.php on line 1930

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Registry.php on line 1469

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/ChannelFile.php on line 19

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/ChannelFile.php on line 20

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/ChannelFile.php on line 21

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102
[PEAR] Archive_Tar    - already installed: 1.4.7

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102
[PEAR] Console_Getopt - already installed: 1.4.2

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile/v2.php on line 1978

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Task/Replace.php on line 18

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102
[PEAR] Structures_Graph- already installed: 1.1.1

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102
[PEAR] XML_Util       - already installed: 1.4.3

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile/v2.php on line 1978

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Task/Windowseol.php on line 18

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile/v2.php on line 1978

Warning: require_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/Task/Unixeol.php on line 18

Warning: include_once(): PHP_Archive::stream_set_option is not implemented! in phar://install-pear-nozlib.phar/PEAR/PackageFile.php on line 102
[PEAR] PEAR           - already installed: 1.10.9
Wrote PEAR system config file at: /opt/phpswitcher/20190827/php7.4/etc/pear.conf
You may want to add: /opt/phpswitcher/20190827/php7.4/share/pear to your php.ini include_path
make[2] : on quitte le répertoire « /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build »
make[1] : on quitte le répertoire « /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build »
touch install-7.4-stamp

So, the install pass but see the multiple warnings for which I've already opened another issue ;)
 [2019-08-27 10:08 UTC] l dot declercq at nuxwin dot com
See also https://github.com/php/php-src/blob/PHP-7.3/configure.ac#L1569 (statement was here)...
 [2019-08-27 10:16 UTC] nikic@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: petk
 [2019-08-27 10:24 UTC] l dot declercq at nuxwin dot com
So, the issue is about the release manager, or your release tool which has put the archive in the 7.0.4beta4 distribution... A choice need to be made here, either your remove the statement and so, the installer is always downloaded, either you provide the installer as a part of the distribution.

From my point of view, you should revert back because:

1. Some changes in the installer could break a released version
2. An network problem could arrise, making the installer unavailable for download...
 [2019-08-28 01:44 UTC] petk@php.net
Hello, maybe we can get a reproducible procedure here... So basically, this:

    docker run -it --rm debian bash
    cd /opt
    apt update && apt install -y wget make gcc xz-utils libxml2-dev pkgconfig
    wget https://downloads.php.net/~derick/php-7.4.0beta4.tar.xz
    tar -xvf php-7.4.0beta4.tar.xz
    cd php-7.4.0beta4
    ./configure --disable-all --enable-xml --with-libxml --with-pear
    make -j$(nproc)
   make install
   which pear
   pear version

This works ok. Yes? The warnings seem to be addressed in the pull request in the pear repo by Nikic now...

The line that has been removed in PHP 7.4 in configure.ac is not relevant since there is a packaged phar file appended in the php release download or it is downloaded from the remote location when using Git. This script directory was once part of the PEAR bundled files installation (not packaged into a PHAR single file).
 [2019-08-28 02:06 UTC] phpbugreports at gmail dot com
not that i really care about pear but are you people aware that downloads from the web are a no-go for linux distributions? Fedora koji/mock just don't have internet access at all when building packages for good reasons

also in context of reproduceable builds it's a no-go
 [2019-08-28 02:12 UTC] petk@php.net
-Status: Assigned +Status: Feedback
 [2019-08-28 02:12 UTC] petk@php.net
> also in context of reproduceable builds it's a no-go

Then this particular issue is resolved?
 [2019-08-28 02:16 UTC] phpbugreports at gmail dot com
solved what?

i talk about "the installer is always downloaded" which is simply a no-go given that everything which is needed to build has to be part of the tarball for sane and reproduceable builds

https://en.wikipedia.org/wiki/Reproducible_builds
 [2019-08-28 02:17 UTC] l dot declercq at nuxwin dot com
-Status: Feedback +Status: Assigned
 [2019-08-28 02:17 UTC] l dot declercq at nuxwin dot com
@petk

You're wrong. The line from the configure.ac is still relevant, at least the one creating the pear directory inside the build directory. If the pear directory is missing in the build directory (not the top build directory) and that a packaged phar file is appended in the php release, the installation will fails.

About downloading: It would be really a bad choice to rely on network only.
 [2019-08-28 02:22 UTC] l dot declercq at nuxwin dot com
@petk

Don't known how you have have made your test but please, don't forget that most of time, we will build in dedicated directory, inside the top build directory.

For instance:

configure: $(CONFIGURE_TARGETS)
configure-%-stamp: patch-stamp prepared-stamp
	rm -rf $*-build
	mkdir $*-build
	cd $*-build && CFLAGS="$(CFLAGS)" PROG_SENDMAIL="$(PROG_SENDMAIL)" ../configure ${$*_CONFIG}
	cd $*-build && \
	cp ../Zend/zend_ini_scanner.c ../Zend/zend_language_scanner.c \
	   ../Zend/zend_ini_parser.h ../Zend/zend_language_parser.h \
	   ../Zend/zend_ini_parser.c ../Zend/zend_language_parser.c \
	   Zend/
	touch configure-$*-stamp

build: $(BUILD_TARGETS)
build-%-stamp: configure-%-stamp
	cd $*-build && make $(NUMJOBS)
	touch build-$*-stamp
 [2019-08-28 02:26 UTC] petk@php.net
Then I am not sure what is the issue here. Can you explain and talk about the issue or send a pull request?

The PHP-7.4.0beta4 package downloaded from https://downloads.php.net/~derick/ includes this phar PEAR installation file at pear/install-pear-nozlib.phar so no additional files are needed to have downloaded for installing PEAR.

The Git repository is something else. There such file is not included and needs to be downloaded at the installation time. The Git repo is not a PHP release file.
 [2019-08-28 02:33 UTC] l dot declercq at nuxwin dot com
petk@php.net

I've explained you already. When you build in a subdirectory (build directory), and if the pear directory isn't create in that directory, the pear installation will fail in case the pear/install-pear-nozlib.phar has been provided in the top build directory.

Basically, when I build, I've the following:

root@phpswitcher:/# tree /usr/local/src/phpswitcher/php-7.4.0beta4/pear/
/usr/local/src/phpswitcher/php-7.4.0beta4/pear/
├── fetch.php
├── install-pear-nozlib.phar
├── install-pear.txt
└── Makefile.frag

0 directories, 4 files

On that, we agreed together. But my build is done in a subdirectory, that is: /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build

and if the pear directory isn't created inside the /usr/local/src/phpswitcher/php-7.4.0beta4/7.4-build build directory (past behavior), the PEAR installation will fail, at least when the install-pear-nozlib.phar is part of the release.
 [2019-08-28 02:36 UTC] l dot declercq at nuxwin dot com
@petk

To fix the problem, I had to patch as follow:


--- a/configure.ac
+++ b/configure.ac
@@ -1550,6 +1550,7 @@
 
 AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
 
+$php_shtool mkdir -p pear
 $php_shtool mkdir -p scripts
 $php_shtool mkdir -p scripts/man1
 [2019-08-28 02:38 UTC] petk@php.net
Ok, yes. Now, I understand. Confirmed then. Thanks for reporting..
 [2019-08-28 02:44 UTC] l dot declercq at nuxwin dot com
@petk

You're welcome. I'm sorry for by wronglish...
 [2019-08-28 15:28 UTC] petk@php.net
The following pull request has been associated:

Patch Name: Fix #78460: PEAR installation failure
On GitHub:  https://github.com/php/php-src/pull/4639
Patch:      https://github.com/php/php-src/pull/4639.patch
 [2019-08-30 02:32 UTC] petk@php.net
Automatic comment on behalf of peterkokot@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=18a2f0849ff644b2e7921e287d5ae9e84a19aa71
Log: Fix #78460: PEAR installation failure
 [2019-08-30 02:32 UTC] petk@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 05:01:26 2019 UTC