Home » PEAR » PEAR » Bug #1379
is_file returns true when seeing pear binary when trying to install pear packag
Details
| Submitted | 2004-05-11 01:43 UTC |
|---|---|
| From | i at camerongreen dot org |
| Status | Wont fix |
| Package | PEAR |
| PHP Version | 5.0.0RC1 (Release Candidate 1) |
| OS | Fedora |
| Roadmaps | (Not assigned) |
Comments
[2004-05-11 01:43 UTC] i at camerongreen dot org
Description:
------------
On attempting to upgrade the pear package from within the directory which contains the pear binary, the is_file call in the doDownload function of Downloader.php returns true.
The is_file function is trying to figure out whether the packages it intends to upgrade are already downloaded. When it sees the pear binary, although it is really looking for the 'pear' package, it can't tell the difference and says "yes I have already downloaded this package".
It then tries to see if it is a valid tgz file, which of course fails and the whole upgrade fails for all packages. You should do the check for whether it is a valid tgz file at the same time as you do the is_file, if one of these fails, go and download a new copy of the module.
More of an oddity than anything else, but it is easily fixable and I am sure it will come up for other users and probably should be fixed.
Reproduce code:
---------------
line 333 of Downloader.php
function doDownload($packages)
{
$mywillinstall = array();
$state = $this->_preferredState;
// {{{ download files in this list if necessary
foreach($packages as $pkgfile) {
$need_download = false;
if (!is_file($pkgfile)) {
If you put a print after the is_file, you will note all other upgradeable packages are listed but not the 'pear' package.
Expected result:
----------------
Fail all upgrades.
Actual result:
--------------
[root@helios bin]# pwd
/usr/local/php/bin
[root@helios bin]# ./pear upgrade-all
Will upgrade archive_tar
Will upgrade http
Will upgrade mail
Will upgrade net_smtp
Will upgrade net_socket
Will upgrade pear
Will upgrade xml_parser
Will upgrade xml_rpc
downloading Archive_Tar-1.2.tgz ...
Starting to download Archive_Tar-1.2.tgz (14,792 bytes)
.....done: 14,792 bytes
downloading HTTP-1.2.3.tgz ...
Starting to download HTTP-1.2.3.tgz (3,515 bytes)
...done: 3,515 bytes
downloading Mail-1.1.3.tgz ...
Starting to download Mail-1.1.3.tgz (13,415 bytes)
...done: 13,415 bytes
downloading Net_SMTP-1.2.6.tgz ...
Starting to download Net_SMTP-1.2.6.tgz (9,106 bytes)
...done: 9,106 bytes
downloading Net_Socket-1.0.2.tgz ...
Starting to download Net_Socket-1.0.2.tgz (3,706 bytes)
...done: 3,706 bytes
Could not get contents of package "/usr/local/php-5-0-0rc1/bin/pear". Invalid tgz file.