php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25008 unhelpful Installer Error Message
Submitted: 2003-08-10 19:33 UTC Modified: 2003-08-29 15:50 UTC
From: cellog@php.net Assigned: cellog (profile)
Status: Closed Package: PEAR related
PHP Version: 4.3.3 OS: na
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cellog@php.net
New email:
PHP Version: OS:

 

 [2003-08-10 19:33 UTC] cellog@php.net
Description:
------------
if you try to install a package from a package.xml, and a file is listed in the package.xml that doesn't exist, the error message is not helpful.  This patch changes the error message to let you know what happened

Index: pear/PEAR/Installer.php
===================================================================
RCS file: /repository/php-src/pear/PEAR/Installer.php,v
retrieving revision 1.93
diff -u -r1.93 Installer.php
--- pear/PEAR/Installer.php	4 Aug 2003 13:31:35 -0000	1.93
+++ pear/PEAR/Installer.php	11 Aug 2003 00:29:45 -0000
@@ -222,6 +222,10 @@
             $this->log(3, "+ mkdir $dest_dir");
         }
         if (empty($atts['replacements'])) {
+            if (!file_exists($orig_file)) {
+                return $this->raiseError("file does not exist",
+                                         PEAR_INSTALLER_FAILED);
+            }
             if (!@copy($orig_file, $dest_file)) {
                 return $this->raiseError("failed to write $dest_file",
                                          PEAR_INSTALLER_FAILED);
@@ -231,6 +235,10 @@
                 $md5sum = md5_file($dest_file);
             }
         } else {
+            if (!file_exists($orig_file)) {
+                return $this->raiseError("file does not exist",
+                                         PEAR_INSTALLER_FAILED);
+            }
             $fp = fopen($orig_file, "r");
             $contents = fread($fp, filesize($orig_file));
             fclose($fp);
@@ -695,6 +703,9 @@
                 if (PEAR::isError($res)) {
                     if (empty($options['ignore-errors'])) {
                         $this->rollbackFileTransaction();
+                        if ($res->getMessage() == "file does not exist") {
+                            $this->raiseError("file $file in package.xml does not exist");
+                        }
                         return $this->raiseError($res);
                     } else {
                         $this->log(0, "Warning: " . $res->getMessage());


Expected result:
----------------
file XXX in package.xml does not exist

Actual result:
--------------
failed to write /temppath/.tmpXXX

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-29 15:50 UTC] cellog@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 17:01:30 2024 UTC