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

Bug #1852 Wrong usage of pclose() return value in Builder
Submitted: 2004-07-12 11:05 UTC
From: yunosh Assigned:
Status: Bogus Package: PEAR
PHP Version: 4CVS-2004-07-12 (stable) OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-12 11:05 UTC] yunosh
Description: ------------ PEAR_Builder::_runCommand() checks the return value of pclose(), but this value is *not* the return state of the called program. In my case phpize returned 0, but pclose() calling phpize returned -1. Thus running "pear install insert-your-favourite-pecl-package" fails with: `phpize' failed

Comments

 [2004-08-26 15:01 UTC] yunosh
This is caused by pclose returning wrong results if php is compiled with --enable-sigchild. Removing this compile option fixes this error.
 [2006-04-27 11:43 UTC] baco at infomaniak dot ch (Guy Baconniere)
I Confirm this bug also present in PHP 5.1.2 if compiled with enable-sigchild bug in function PEAR_Builder::_runCommand() --- /opt/php/lib/php/PEAR/Builder.php 2006-04-26 16:18:12.000000000 +0200 +++ /opt/php/lib/php/PEAR/Builder.php 2006-04-27 11:56:13.201667500 +0200 @@ -432,6 +432,7 @@ $callback[0]->debug = $olddbg; } $exitcode = @pclose($pp); + $exitcode = 0; return ($exitcode == 0); } $ strace /opt/php/bin/php -C -q -d include_path=/opt/php/lib/php -d output_buffering=1 /opt/php/lib/php/pearcmd.php install pecl/zip2> before.txt downloading zip-1.0.tgz ... Starting to download zip-1.0.tgz (4,930 bytes) .....done: 4,930 bytes 3 source files, building running: phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20050922 Zend Extension Api No: 220051025 ERROR: `phpize' failed AFTER PATCHED PEAR/Builder.php $ strace /opt/php/bin/php -C -q -d include_path=/opt/php/lib/php -d output_buffering=1 /opt/php/lib/php/pearcmd.php install pecl/zip2> after.txt downloading zip-1.0.tgz ... Starting to download zip-1.0.tgz (4,930 bytes) .....done: 4,930 bytes 3 source files, building running: phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20050922 Zend Extension Api No: 220051025 building in /var/tmp/pear-build-root/zip-1.0 running: /tmp/tmpbJ5ZjW/zip-1.0/configure checking for egrep... grep -E checking for a sed that does not truncate output... /bin/sed ...
 [2011-09-11 15:54 UTC] rjung (Rainer Jung)
Confirmed for 5.3.8. pclose() returns "-1" for phpize. Details from strace: Builder with PID 13014 forks PID 13018 13018 execve("/bin/sh", ["sh", "-c", "phpize 2>&1"], [/* 73 vars */]) = 0 which forks 13019 13019 execve("/shared/build/autobuild/php/install/110910.sles10.x86_64/mod_php53_apache22-prefork/bin/phpize", ["phpize"], [/* 74 vars */]) = 0 and at the end of phpize we get 13019 <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 13260 13019 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 13019 --- SIGCHLD (Child exited) @ 0 (0) --- 13019 wait4(-1, 0x7fff55b0caf4, WNOHANG, NULL) = -1 ECHILD (No child processes) 13019 rt_sigreturn(0x8) = 0 13019 rt_sigaction(SIGINT, {SIG_DFL}, {0x42ea17, [], SA_RESTORER, 0x2b4e55594b20}, 8) = 0 13019 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 13019 read(255, "\necho exit 0\nexit 0\n", 4863) = 20 13019 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 13019 write(1, "exit 0\n", 7 <unfinished ...> 13014 <... read resumed> "exit 0\n", 8192) = 7 13014 write(1, "exit 0\n", 7) = 7 13014 read(3, <unfinished ...> 13019 <... write resumed> ) = 7 13019 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 13019 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 13019 exit_group(0) = ? 13018 <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 13019 13018 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 13018 --- SIGCHLD (Child exited) @ 0 (0) --- 13018 wait4(-1, 0x7fffbf8731b4, WNOHANG, NULL) = -1 ECHILD (No child processes) 13018 rt_sigreturn(0x8) = 0 13018 rt_sigaction(SIGINT, {SIG_DFL}, {0x42ea17, [], SA_RESTORER, 0x2aadeb82eb20}, 8) = 0 13018 exit_group(0) = ? 13014 <... read resumed> "", 8192) = 0 13014 --- SIGCHLD (Child exited) @ 0 (0) --- 13014 wait4(-1, NULL, WNOHANG, NULL) = 13018 13014 wait4(-1, NULL, WNOHANG, NULL) = -1 ECHILD (No child processes) 13014 rt_sigaction(SIGCHLD, {0x6bbec0, [CHLD], SA_RESTORER|SA_RESTART, 0x2ae2abe38b20}, {0x6bbec0, [CHLD], SA_RESTORER|SA_RESTART, 0x2ae2abe38b20}, 8) = 0 13014 rt_sigreturn(0x11) = 0 13014 close(3) = 0 13014 wait4(13018, 0x7fffff7d8b3c, 0, NULL) = -1 ECHILD (No child processes) configure included --enable-sigchild because of Oracle.