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

Bug #18238 Wrong return code from "pear help"
Submitted: 2011-02-04 15:27 UTC
From: timj Assigned: till
Status: Closed Package: PEAR (version 1.9.1)
PHP Version: 5.3.5 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2011-02-04 15:27 UTC] timj (Tim Jackson)
Description: ------------ Reported in Fedora at https://bugzilla.redhat.com/show_bug.cgi?id=502055 : "If you execute the command "pear help" and then you check the return code, you will get 1, but it should be 0 as success." Reproducible on current PEAR 1.9.1 Test script: --------------- pear help >/dev/null;echo $? Expected result: ---------------- 0 Actual result: -------------- 1

Comments

 [2011-02-23 21:11 UTC] till (Till Klampaeckel)
This also happens with -s and -o switches. I guess it's a general problem.
 [2011-02-23 22:02 UTC] till (Till Klampaeckel)
Just a summary from our brief discussion on IRC: scripts/pearcmd.php only handles the return code on some occasions. As far as I can tell the error handling used needs to be made context aware and also aware of options passed to pear. Right now the installer uses Pear::raiseError() everywhere. The error handler registered is PHP_Frontend_CLI::displayFatalError(). If someone wants to take a crack at it, this is probably the right place.
 [2011-02-23 22:03 UTC] till (Till Klampaeckel)
Added patch help.
 [2011-02-23 22:04 UTC] till (Till Klampaeckel)
The attached patch corrects the exit status were possible in scripts/pearcmd.php. It's not the final solution to all other status code related issues.
 [2011-02-27 20:00 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Status: Open +Status: Closed -Assigned To: +Assigned To: till
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. Till, can you create a new ticket with those other issues and copy some of the text from here? Similar issues but not the same.