FS#3563 - bug in php pear (in php package)

Attached to Project: Arch Linux
Opened by David Rosenstrauch (darose) - Friday, 02 December 2005, 16:50 GMT
Last edited by Judd Vinet (judd) - Monday, 05 December 2005, 08:02 GMT
Task Type Bug Report
Category System
Status Closed
Assigned To dorphell (dorphell)
Architecture not specified
Severity High
Priority Normal
Reported Version 0.7 Wombat
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The recent upgrade to php 5.1.1 appears to break the php pear system:

[darose@vnyc190562661 ~]$ pear
Could not open input file: /home/build/repos/arch/build/devel/php/pkg/usr/share/pear/pearcmd.php

The cause appears to be that the package maintainer has hard-coded in their own personal directory structure in the pear config, rather than using the standard arch locations (/usr/share/pear/).
This task depends upon

Closed by  dorphell (dorphell)
Monday, 05 December 2005, 16:35 GMT
Reason for closing:  Fixed
Additional comments about closing:  stupid can of worms =]
Comment by David Rosenstrauch (darose) - Friday, 02 December 2005, 16:51 GMT
Ack! This is not actually a "critical" bug. I meant to mark it as "high", but hit "critical" accidentally. Any dev who sees this, please update accordingly.
Comment by pete (drg006) - Sunday, 04 December 2005, 02:10 GMT
the easiest temporary fix for this bug is to replace "/home/build/repos/arch/build/devel/php/pkg" with "" in /usr/share/pear/pearcmd.php
(this means that the path is hard-coded into more than just /etc/pear.conf)
Comment by ... (spider007) - Sunday, 04 December 2005, 17:05 GMT
You need to manually patch these files:

/usr/share/pear/peclcmd.php
/usr/share/pear/.registry/console_getopt.reg
/usr/share/pear/.registry/archive_tar.reg
/usr/share/pear/.registry/pear.reg
/usr/share/pear/pearcmd.php
/usr/share/pear/PEAR/Command/Package.php

use `vi`: :%s/\/home\/build\/repos\/arch\/build\/devel\/php\/pkg//g
Comment by pete (drg006) - Sunday, 04 December 2005, 17:18 GMT
oops, my fix will get the script running, but it will still install the packages to the wrong directory. please follow Sjon's instructions.
Comment by dorphell (dorphell) - Sunday, 04 December 2005, 18:14 GMT
That's too constricting, every person that builds php will have a different 'absolute' leading path so you need a more generic fix.

This is the fix I'm committing:

---------
cd $startdir/pkg
sed "s|`pwd`||g" -i usr/share/pear/.registry/{console_getopt.reg,archive_tar.reg,pear.reg} etc/pear.conf \
usr/share/pear/{peclcmd.php,pearcmd.php,PEAR/Command/Package.php} usr/bin/{pear,peardev,pecl}
---------
Comment by dorphell (dorphell) - Sunday, 04 December 2005, 20:41 GMT
Had to reopen this bug..
pear is still broken

Now error is:
Notice: unserialize(): Error at offset 91 of 810 bytes in Config.php on line 971
ERROR: The default config file is not a valid config file or is corrupted.
Comment by pete (drg006) - Sunday, 04 December 2005, 20:50 GMT
I made a new report ( FS#3577 ) but i'll recommend that it be closed.
Comment by David Rosenstrauch (darose) - Sunday, 04 December 2005, 22:16 GMT
Just curious: How did this problem come about in the first place? The path "/home/build/repos/arch/build/devel/php/pkg/usr/share/pear/" seems like it's a path that an Arch dev would have created, and not something that came from upstream, right? If so, seems like this would be a big bug for a dev to let slip through into production, no? Thoughts anyone?
Comment by dorphell (dorphell) - Sunday, 04 December 2005, 22:29 GMT
It came about because a bug in the configure script of php and/or Makefile. It uses INSTALL_ROOT dynamically and hardcodes absolute paths.
Comment by dorphell (dorphell) - Monday, 05 December 2005, 02:53 GMT
Okay. Here's the final fix... it's ugly and cumbersome but I rather not use a whole script for a temp resolution. It will be fixed in the official PHP pkg soon.

---------
cd $startdir/pkg
sed "s|$PWD||g" -i usr/share/pear/.registry/{console_getopt.reg,archive_tar.reg,pear.reg} \
usr/share/pear/{peclcmd.php,pearcmd.php,PEAR/Command/Package.php} usr/bin/{pear,peardev,pecl}

sed 's#:\([0-9]*\):\"'$PWD'#:$((\1-'`echo -n $PWD|wc -c`')):\"#g; s#\"#\\"#g; s#.*#echo "&"#g' etc/pear.conf |sh > etc/pear.conf.tmp
mv etc/pear.conf.tmp etc/pear.conf
---------
Comment by dorphell (dorphell) - Monday, 05 December 2005, 05:41 GMT
Well my job here is done. pear works, closing *again*
Comment by Judd Vinet (judd) - Monday, 05 December 2005, 08:02 GMT
Re-opened by pete:

pear still isn't working for me: the command 'pear install PEAR' spit out many errors and failed to do an upgrade.
Comment by dorphell (dorphell) - Monday, 05 December 2005, 14:03 GMT
Bah..
I found the problem.. didn't notice /usr/share/pear/.registry/pear.reg has the same problem as /etc/pear.conf.
Comment by pete (drg006) - Monday, 05 December 2005, 14:52 GMT
My error messages:

[root@darkstar ~]# pear install DB

Notice: unserialize(): Error at offset 41157 of 65191 bytes in PEAR/Registry.php on line 1006
pear/DB requires package "pear/PEAR" (version >= 1.0b1), installed version is
No valid packages found
install failed
[root@darkstar ~]# pear install PEAR

Notice: unserialize(): Error at offset 41157 of 65191 bytes in PEAR/Registry.php on line 1006

Notice: unserialize(): Error at offset 1847 of 4797 bytes in PEAR/Registry.php o n line 1006

Notice: unserialize(): Error at offset 1847 of 4797 bytes in PEAR/Registry.php o n line 1006

Notice: unserialize(): Error at offset 909 of 2409 bytes in PEAR/Registry.php on line 1006

Notice: unserialize(): Error at offset 909 of 2409 bytes in PEAR/Registry.php on line 1006
Did not download optional dependencies: pear/XML_RPC, use --alldeps to download automatically

Notice: unserialize(): Error at offset 41157 of 65191 bytes in PEAR/Registry.php on line 1006

Notice: unserialize(): Error at offset 41157 of 65191 bytes in PEAR/Registry.php on line 1006
Skipping package "pear/PEAR", already installed as version
No valid packages found
install failed
[root@darkstar ~]# pear install DB

Notice: unserialize(): Error at offset 41157 of 65191 bytes in PEAR/Registry.php on line 1006
pear/DB requires package "pear/PEAR" (version >= 1.0b1), installed version is
No valid packages found
install failed
[root@darkstar ~]#
Comment by dorphell (dorphell) - Monday, 05 December 2005, 15:38 GMT
Yeah, i saw it.. i'll fix it in a bit, i'm busy with real-life work atm.
Comment by David Rosenstrauch (darose) - Monday, 05 December 2005, 15:50 GMT
Please close #3579 then. It is now a dupe of this bug. I opened it because this bug had been closed and so I could no longer add comments to it. Thanks! DR
Comment by dorphell (dorphell) - Monday, 05 December 2005, 16:34 GMT
Okay, just fixed and tested, PEAR now installs.

Loading...