From:             
Operating system: Centos5
PHP version:      5.3.3
Package:          Unknown/Other Function
Bug Type:         Bug
Bug description:Passthru and Signals Appear Not Handled

Description:
------------
So I'm not really sure if this is a configuration issue or a bug, but
passthru doesn't seem to be handling the signal due to ulimit as expected
on Centos5.  



If I run myscript.sh at the bash command line, I get a nice "File too large
detected via return code" show up and 2.1 MB of the 5 MB file copied. So it
appears cp child process caught and handled the SIGXFSZ signal.



But when I run the PHP script, while the o/s stops cp at 2.1 MB, but
${LOCALRET} is 1 (of course I also see the "Got 0 as always" message as
myscript.sh always returns 0). Somehow the child of myscript.sh isn't
getting the signal properly it seems. In fact if it's a more elaborate
process than a cp, it will not stop the process -- The process appears not
to have gotten the signal (of course the o/s won't let it write more than
2.1 MB but it seems to be obvious to the signal).



When I'm on MacOS (running same PHP 5.3.3 with Apache 2) the signals seem
to work correctly. So am I misunderstanding something here? Is there a
configuration setting in PHP to make the Centos behave like the MacOS?  Or
is this a Centos PHP bug?



BTW the Centos configure options are:

./configure --with-mysqli --with-zlib --with-xml --with-mysql
--with-openssl --enable-sockets --enable-calendar --with-curl --with-apxs2

Test script:
---------------
<?php 

echo "<pre>";

passthru('/bin/myscript.sh',$return_code);

echo "<br>";

echo "Got $return_code as always";

echo "</pre>";

?>







#!/bin/bash



# set max write size to 2.1 MB and trigger SIGXFSZ

ulimit -f 2100  



cp /path/5mb_file /path/5mb_file.cp

LOCALRET=$?



# return code = 128+SIGXFSZ = 153 (on Centos and MacOS anyway)

if [[ ${LOCALRET} -eq 153 ]]; then

 echo "File too large detected via return code"

else

 echo "Got ${LOCALRET}"

fi



exit 0

Expected result:
----------------
File too large detected via return code

Got 0 as always

Actual result:
--------------
Got 1

Got 0 as always

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53489&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53489&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53489&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53489&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53489&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53489&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53489&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53489&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53489&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53489&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53489&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53489&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53489&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53489&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53489&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53489&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53489&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53489&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53489&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53489&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53489&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53489&r=mysqlcfg

Reply via email to