Fwd: RE: [PHP-DEV] Bug #8732
| From: | Andi Gutmans | Date: | Sat, 03 Feb 2001 16:35:40 +0000 |
| Subject: | Fwd: RE: [PHP-DEV] Bug #8732 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-45672@lists.php.net to get a copy of this message | ||
Anyone else bump into something like this?
Andi
Subject: RE: [PHP-DEV] Bug #8732
Date: Fri, 2 Feb 2001 13:54:09 +0100 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] Bug #8732 Thread-Index: AcCG63JZ+YNk1p38Q8COcgf0ren1RwGK6w/Q From: "Edin Kadribasic" <edink@proventum.net> To: "Andi Gutmans" <andi@zend.com> Hi Andi, I think that you should have enogh info to fix the problem now. Please see the two attached messages and let me know if that is enough. Edin -----Original Message----- From: Andi Gutmans [mailto:andi@zend.com] Sent: Thursday, January 25, 2001 5:30 PM To: Edin Kadribasic Subject: Re: [PHP-DEV] Bug #8732 Is your /tmp writeable? ls -ld /tmp. I know it might be an obvious question. Andi At 09:55 AM 1/25/2001 +0100, Edin Kadribasic wrote: I've tried them all. Even '/bin/sh -c "/bin/mkdir /tmp/test"'. It is very hard to reproduce, because I have the exact same setup on several 5 machines, and I'm having problems only on one of them. Server 1: RH 6.1, 2xPIII 550 MHz /* PHP exec functions broken */ Server 2: RH 6.2, 2xPIII 933 MHz Server 3: RH 6.1, 3xPII 450 MHz Server 4: RH 6.1, 2XPIII 550 MHz Server 5: RH 6.1, 1xPIII 550 MHz The only config change on the machine, was addition of the second processor. I'm not exactly sure if the problem begun occuring around the time we upgraded the machines. Edin ----- Original Message ----- From: "Andi Gutmans" <andi@zend.com> To: "Edin Kadribasic" <edink@proventum.net> Sent: Thursday, January 25, 2001 6:35 AM Subject: Re: [PHP-DEV] Bug #8732Will it work with full-path? "/bin/mkdir /tmp/test"? I can try and reproduce this evening (my time). If you can send mean Emailreminder that will help :) Andi At 03:37 AM 1/25/2001 +0100, Edin Kadribasic wrote:(RedHatSorry for not being more specific, but all those machines are Linux4.0.1pl1,6.1 6.2). Funny part is the site has not been modified in sincelatestand all of a sudden decided not to work anymore. Tried with theavail.release 4.0.4pl1, recompiled apache (used to be 1.3.9), but to noNo errorsSimple system("mkdir /tmp/test", $r) would fail with $r set to -1.servers.or warnings printed. Edin ----- Original Message ----- From: Andi Gutmans <andi@zend.com> To: Edin Kadribasic <edink@proventum.net>; PHP Development (E-mail) <php-dev@lists.php.net> Sent: Wednesday, January 24, 2001 7:39 PM Subject: Re: [PHP-DEV] Bug #8732Executing external programs right now doesn't work on Windows. Hopefully this will be fixed soon. Andi At 12:14 PM 1/24/2001 +0100, Edin Kadribasic wrote:I'm experiencing the same probmlem on one of our 5 productionmessagesExec functions always fail with -1 as the return code. No errorwhat'sor warnings are displayed. Any suggestion on how to find outphp-list-admin@lists.php.nethappening? Edin-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail:X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 Received: from provmail.proventum.dk ([10.0.0.49]) by asp-exchange.proventum.net with Microsoft SMTPSVC(5.0.2195.1600); Wed, 31 Jan 2001 22:39:37 +0100 Received: by provmail.proventum.dk (Postfix) id 93F6C233BD; Wed, 31 Jan 2001 23:38:49 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain;charset="iso-8859-1"content-class: urn:content-classes:message Subject: [PHP-DEV] PHP 4.0 Bug #9040: Exec sets return_val to -1 when compiled with "--enable-sigchild" Date: Wed, 31 Jan 2001 22:38:35 +0100 Message-ID: <20010131213835.31169.qmail@php2.chek.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] PHP 4.0 Bug #9040: Exec sets return_val to -1 when compiled with "--enable-sigchild" Thread-Index: AcCLzk9KrFtRXMcUTjClvGg8huthcw== From: <jase@sensis.com> To: <php-dev@lists.php.net>From: jase@sensis.comOperating system: Linux 2.2.17PHP version: 4.0.3pl1 PHP Bug Type: Program ExecutionBug description: Exec sets return_val to -1 when compiled with "--enable-sigchild" I was encouraged to submit this as a bug report... I acutally compiled the source from Debian's archive, with the latest security fix (which I think it found in 4.0.4pl1). I was having trouble with oracle support, so I configured with "--enable-sigchild". That did not help my problem. I finally went back to my older oracle libraries, and was able to get them to work, but left "--enable-sigchild" configured in. Then I noticed that all of my exec functions were setting return_val (the third parameter) to -1, indicating an error. I can include an strace of the problem if needed. I think that the problem was that there were 2 wait4 system calls, one after another. The second one would return a -1. But, I'm not sure, and I'm not much of a programmer. Here is the strace after the exec process has finished exiting.[pid 25359] _exit(0) = ? <... read resumed> "", 4096) = 0--- SIGCHLD (Child exited) ---wait4(-1, NULL, WNOHANG, NULL) = 25359 wait4(-1, NULL, WNOHANG, NULL) = -1 ECHILD (No child processes)Hope this helps someone. Let me know if you need any more info. Jase -- Edit Bug report at: http://bugs.php.net/?id=9040&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 Received: from provmail.proventum.dk ([10.0.0.49]) by asp-exchange.proventum.net with Microsoft SMTPSVC(5.0.2195.1600); Tue, 30 Jan 2001 08:42:09 +0100 Received: by provmail.proventum.dk (Postfix) id 775CC233B6; Tue, 30 Jan 2001 09:41:09 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain;charset="iso-8859-1"content-class: urn:content-classes:message Subject: [PHP-DEV] PHP 4.0 Bug #8992: exec($cmd,$ret,$status) always return $status is -1 Date: Tue, 30 Jan 2001 08:40:57 +0100 Message-ID: <20010130074057.15461.qmail@php2.chek.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] PHP 4.0 Bug #8992: exec($cmd,$ret,$status) always return $status is -1 Thread-Index: AcCKkCasuI0qs/kTQ+OiC9+Kgnb9XQ== From: <yasushi_takahashi@tsuken.co.jp> To: <php-dev@lists.php.net>From: yasushi_takahashi@tsuken.co.jpOperating system: Linux 2.2.13-33PHP version: 4.0.3pl1 PHP Bug Type: Scripting Engine problemBug description: exec($cmd,$ret,$status) always return $status is -1 PHP scripts <? $cmd = "ls"; $ar = array(); exec($cmd, $ar, $atatus); echo $status; ?> $status is always -1 (accidential it is 0). May be PHP's source code file ext/standard/exec.c line 187's pclose(fp) returns -1. becose main/main.c line 598's signal(SIGCHLD,sigchild_handler) destory child prosess status. mey be fixed it to replase ext/standard/exec.c follows. add include #include <signal.h> add variable declaration void (*sig_hadler)(); add "signal handler for SIGCHLD set to SIG_DFL" at top of _Exec() sig_handler = signal (SIGCHLD, SIG_DFL); add "signal handler for SIGCHLD back to before" at before every return statments signal (SIGCHLD, sig_handler); This is patch. -----------------------------start---------------------- diff -uNr php-4.0.3pl1.orig/ext/standard/exec.c php-4.0.3pl1/ext/standard/exec.c--- php-4.0.3pl1.orig/ext/standard/exec.c Wed Sep 6 01:55:32 2000 +++ php-4.0.3pl1/ext/standard/exec.c Tue Jan 30 16:23:40 2001@@ -30,6 +30,7 @@ #if HAVE_SYS_WAIT_H #include <sys/wait.h> #endif +#include <signal.h> /* * If type==0, only last line of output is returned (exec) @@ -46,11 +47,14 @@int t, l, ret, output=1; int overflow_limit, lcmd, ldir; char *b, *c, *d=NULL; + void (*sig_handler)(); PLS_FETCH();+ sig_handler = signal (SIGCHLD, SIG_DFL); buf = (char*) emalloc(EXEC_INPUT_BUF); if (!buf) { php_error(E_WARNING, "Unable to emalloc %d bytes forexec buffer", EXEC_INPUT_BUF);+ signal (SIGCHLD, sig_handler); return -1; } buflen = EXEC_INPUT_BUF;@@ -65,6 +69,7 @@if (strstr(cmd, "..")) { php_error(E_WARNING, "No '..' components allowedin path");efree(buf); + signal (SIGCHLD, sig_handler); return -1; } d = emalloc(l);@@ -95,6 +100,7 @@php_error(E_WARNING, "Unable to fork [%s]", d); efree(d); efree(buf); + signal (SIGCHLD, sig_handler); return -1; } } else { /* not safe_mode */@@ -106,6 +112,7 @@if (!fp) { php_error(E_WARNING, "Unable to fork [%s]",cmd);efree(buf); + signal (SIGCHLD, sig_handler); return -1; } }@@ -127,6 +134,7 @@if ( buf == NULL ) { php_error(E_WARNING,"Unable to erealloc %d bytes for exec buffer",buflen +EXEC_INPUT_BUF);+ signal (SIGCHLD,sig_handler);return -1; } buflen += EXEC_INPUT_BUF;@@ -190,6 +198,7 @@ret = WEXITSTATUS(ret); }#endif+ signal (SIGCHLD, sig_handler);if (d) efree(d); efree(buf);-----------------------------end---------------------- pclose() function is also used in ext/standard/file.c mail.c ext/imap/php_imap.c. I do not know this influence. This is part of my phpinfo() outputs. Configure Command'./configure''--enable-sigchild' '--libdir=/var/tmp/php-root/usr/lib/php4' '--includedir=/usr/include' '--with-pgsql=shared' '--with-interbase' '--prefix=/var/tmp/php-root//usr' '--with-apxs=/usr/sbin/apxs' '--with-config-file-path=/etc/httpd' '--enable-safe-mode''--disable-debug''--with-zlib' '--with-gd' '--with-cpdflib''--enable-debugger''--enable-magic-quotes' '--enable-track-vars''--enable-versioning'-- Edit Bug report at: http://bugs.php.net/?id=8992&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net