Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.15

Bug #17350 "pear install --force" doesn't uninstall files from previous pkg versions
Submitted: 2010-04-28 13:14 UTC
From: timj Assigned: dufuz
Status: Closed Package: PEAR (version 1.9.0)
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2010-04-28 13:14 UTC] timj (Tim Jackson)
Description: ------------ When using "pear install --force" to install a different version of package which is already installed, any files existing in the original version but not in the version being force-installed are not removed. Test script: --------------- See attached package.xml files for two packages: - Test_Package99-1.0.0 which has two files, test1.php and test2.php - Test_Package99-1.1.0 which has only one file, test1.php pear install Test_Package99-1.0.0/package2.xml pear install -f Test_Package99-1.1.0/package2.xml This test case is for illustration only; here, there's no reason to force the install. The point still applied in the general case though. Expected result: ---------------- Only one file, test1.php is in php_dir Actual result: -------------- Two files, test1.php and test2.php are in php_dir. test2.php is left over from the old installation of Test_Package99-1.0.0 and is orphaned; it will never be removed.

Comments

 [2010-04-28 13:15 UTC] timj (Tim Jackson)
First package.xml: <?xml version="1.0" encoding="UTF-8"?> <package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>Test_Package99</name> <channel>__uri</channel> <summary>A test package</summary> <description>Whatever</description> <lead> <name>Example User</name> <user>example</user> <email>example@example.comk</email> <active>yes</active> </lead> <date>2007-02-03</date> <version> <release>1.0.0</release> <api>1.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> <license>Foo License</license> <notes>This is the first release. </notes> <contents> <dir name="/"> <file role="php" name="test1.php" /> <file role="php" name="test2.php" /> </dir> </contents> <dependencies> <required> <php> <min>4.3.0</min> </php> <pearinstaller> <min>1.4.0</min> </pearinstaller> </required> </dependencies> <phprelease /> </package>
 [2010-04-28 13:16 UTC] timj (Tim Jackson)
Second package.xml: <?xml version="1.0" encoding="UTF-8"?> <package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>Test_Package99</name> <channel>__uri</channel> <summary>A test package</summary> <description>Whatever</description> <lead> <name>Example User</name> <user>example</user> <email>example@example.comk</email> <active>yes</active> </lead> <date>2007-02-03</date> <version> <release>1.1.0</release> <api>1.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> <license>Foo License</license> <notes>This is the first release. </notes> <contents> <dir name="/"> <file role="php" name="test1.php" /> </dir> </contents> <dependencies> <required> <php> <min>4.3.0</min> </php> <pearinstaller> <min>1.4.0</min> </pearinstaller> </required> </dependencies> <phprelease /> </package>
 [2010-04-29 07:07 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Assigned To: +Assigned To: dufuz
 [2010-08-07 21:21 UTC] dufuz (Helgi Þormar Þorbjörnsson)
If you use the upgrade command, it would in fact clean it out; And installation assumes there is no earlier incarnation of the package and it's quite clearly shown by the fact that you can't install another version of the package unless you use the force option; An upgrade would be the proper one to use... I can look into hooking up the same cleaning procedures into the installation process but it might just add extra overhead to a usage scenario that should not really happen - It might be an idea tho to pass the installation command off to upgrade if installation detects the package has already been installed, be it with force option or not, but at the same time, it might give people unexpected results.
 [2011-07-06 00:30 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.