Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar phar.c phar_internal.h phar_object.c tar.c util.c zip.c

2009-04-29 Thread Antony Dovgal
On 29.04.2009 07:24, Greg Beaver wrote:
 cellogWed Apr 29 03:24:27 2009 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/phar phar.c phar_internal.h phar_object.c tar.c util.c 
   zip.c 
   Log:
   MFPECL: fix PECL bug #16338, php_stream_copy_to_stream{,_ex}()
   

This patch has introduced a segfault with the following backtrace:

(gdb) bt
#0  0x009792be in _zval_ptr_dtor (zval_ptr=0x7fffe327b890, 
__zend_filename=0xedb8f0 /local/qa/5_3.zts/ext/phar/phar_object.c, 
__zend_lineno=316)
at /local/qa/5_3.zts/Zend/zend.h:392
#1  0x006b9d3a in phar_file_action (phar=0x153d998, info=0x153bd50, 
mime_type=0xed7ecd , code=0, entry=0x153c070 /index.php, entry_len=10,
arch=0x1520a98 /local/qa/5_3.zts/ext/phar/tests/fatal_error_webphar.php, 
basename=0x153c0d8 retrieveProjectCoverage, ru=0x0, ru_len=0,
tsrm_ls=0x12291b0) at /local/qa/5_3.zts/ext/phar/phar_object.c:316
#2  0x006bbd48 in zim_Phar_webPhar (ht=1, return_value=0x153ac50, 
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0, tsrm_ls=0x12291b0)
at /local/qa/5_3.zts/ext/phar/phar_object.c:878
#3  0x009c99bf in zend_do_fcall_common_helper_SPEC 
(execute_data=0x7ff3db14e098, tsrm_ls=0x12291b0) at 
/local/qa/5_3.zts/Zend/zend_vm_execute.h:313
#4  0x009cb011 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER 
(execute_data=0x7ff3db14e098, tsrm_ls=0x12291b0)
at /local/qa/5_3.zts/Zend/zend_vm_execute.h:422
#5  0x009c81a4 in execute (op_array=0x153a930, tsrm_ls=0x12291b0) at 
/local/qa/5_3.zts/Zend/zend_vm_execute.h:104
#6  0x0098f4a6 in zend_execute_scripts (type=8, tsrm_ls=0x12291b0, 
retval=0x0, file_count=3) at /local/qa/5_3.zts/Zend/zend.c:1188
#7  0x008d95f4 in php_execute_script (primary_file=0x7fffe3282620, 
tsrm_ls=0x12291b0) at /local/qa/5_3.zts/main/main.c:2166
#8  0x00a9ee45 in main (argc=65, argv=0x7fffe3282848) at 
/local/qa/5_3.zts/sapi/cgi/cgi_main.c:2015


Unfortunately, I'm unable to tell now which test causes it, but hopefully 
Valgrind will tell me in an hour or so.

-- 
Wbr, 
Antony Dovgal

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar phar.c phar_internal.h phar_object.c tar.c util.c zip.c

2009-04-29 Thread Antony Dovgal
On 29.04.2009 07:24, Greg Beaver wrote:
 cellogWed Apr 29 03:24:27 2009 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/phar phar.c phar_internal.h phar_object.c tar.c util.c 
   zip.c 
   Log:
   MFPECL: fix PECL bug #16338, php_stream_copy_to_stream{,_ex}()
   
 

ext/phar/tests/fatal_error_webphar.mem

==29591== Invalid read of size 8
==29591==at 0x693B8A: phar_file_action (phar_object.c:315)
==29591==by 0x6956D1: zim_Phar_webPhar (phar_object.c:878)
==29591==by 0x9203BE: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:313)
==29591==by 0x921103: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER 
(zend_vm_execute.h:422)
==29591==by 0x91F64E: execute (zend_vm_execute.h:104)
==29591==by 0x8F08C2: zend_execute_scripts (zend.c:1188)
==29591==by 0x87BD7B: php_execute_script (main.c:2166)
==29591==by 0x9D691F: main (cgi_main.c:2015)

-- 
Wbr, 
Antony Dovgal

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar phar.c phar_internal.h phar_object.c tar.c util.c zip.c

2009-04-29 Thread Greg Beaver
Antony Dovgal wrote:
 On 29.04.2009 07:24, Greg Beaver wrote:
   
 cellog   Wed Apr 29 03:24:27 2009 UTC

   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/pharphar.c phar_internal.h phar_object.c tar.c 
 util.c 
  zip.c 
   Log:
   MFPECL: fix PECL bug #16338, php_stream_copy_to_stream{,_ex}()
   

 

 ext/phar/tests/fatal_error_webphar.mem

 ==29591== Invalid read of size 8
 ==29591==at 0x693B8A: phar_file_action (phar_object.c:315)
 ==29591==by 0x6956D1: zim_Phar_webPhar (phar_object.c:878)
 ==29591==by 0x9203BE: zend_do_fcall_common_helper_SPEC 
 (zend_vm_execute.h:313)
 ==29591==by 0x921103: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER 
 (zend_vm_execute.h:422)
 ==29591==by 0x91F64E: execute (zend_vm_execute.h:104)
 ==29591==by 0x8F08C2: zend_execute_scripts (zend.c:1188)
 ==29591==by 0x87BD7B: php_execute_script (main.c:2166)
 ==29591==by 0x9D691F: main (cgi_main.c:2015)

   
Oh good - you can reproduce it!  The segfault is not related to the
commit, as you can see from the line in question (line 315 of
phar_file_action is a zval_ptr_dtor of EG(return_value_ptr_ptr), which
has nothing to do with streams).

I found this segfault on my system using apache 2.2 with the test script
and added the fatal_error_webphar test to attempt to reproduce it, but
the test in question passes using cgi on my system.  Would you be able
to forward bt + valgrind errors to Dmitry?  This is a ZE2 problem that
phar's cleanup triggers, and so I need to know how to rewrite the
cleanup so it doesn't trigger the segfault (or ZE2 needs to be fixed,
whichever is the real problem).

Thanks Tony,
Greg

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar phar.c phar_internal.h phar_object.c tar.c util.c zip.c

2009-04-29 Thread Antony Dovgal
On 29.04.2009 17:50, Greg Beaver wrote:
 Oh good - you can reproduce it!  The segfault is not related to the
 commit, as you can see from the line in question (line 315 of
 phar_file_action is a zval_ptr_dtor of EG(return_value_ptr_ptr), which
 has nothing to do with streams).

Well, I don't remember seeing it before.

 I found this segfault on my system using apache 2.2 with the test script
 and added the fatal_error_webphar test to attempt to reproduce it, but
 the test in question passes using cgi on my system. 

It segfaults with CGI here (but no with CLI?).

 Would you be able
 to forward bt + valgrind errors to Dmitry?  This is a ZE2 problem that
 phar's cleanup triggers, and so I need to know how to rewrite the
 cleanup so it doesn't trigger the segfault (or ZE2 needs to be fixed,
 whichever is the real problem).

Ok, I'll ping him.

-- 
Wbr, 
Antony Dovgal

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar phar.c phar_internal.h phar_object.c tar.c util.c zip.c

2009-04-29 Thread Greg Beaver
Antony Dovgal wrote:
 On 29.04.2009 17:50, Greg Beaver wrote:
   
 Oh good - you can reproduce it!  The segfault is not related to the
 commit, as you can see from the line in question (line 315 of
 phar_file_action is a zval_ptr_dtor of EG(return_value_ptr_ptr), which
 has nothing to do with streams).
 

 Well, I don't remember seeing it before.
   
Hi,

This could be because the fatal_error_webphar.phpt test was committed
only 1 day before the commit you did see?
 I found this segfault on my system using apache 2.2 with the test script
 and added the fatal_error_webphar test to attempt to reproduce it, but
 the test in question passes using cgi on my system. 
 

 It segfaults with CGI here (but no with CLI?).
   
It is a web-based test, which means it only runs with the CGI sapi.
 Would you be able
 to forward bt + valgrind errors to Dmitry?  This is a ZE2 problem that
 phar's cleanup triggers, and so I need to know how to rewrite the
 cleanup so it doesn't trigger the segfault (or ZE2 needs to be fixed,
 whichever is the real problem).
 

 Ok, I'll ping him.
   

thanks very much.  I can get a backtrace using gdb, but no valgrind for
the apache crash, although I haven't tried running the server via
valgrind.  Does anyone know if this is even possible to do with a
forking server?

Thanks,
Greg

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar phar.c phar_internal.h phar_object.c tar.c util.c zip.c

2009-04-29 Thread Arnaud Le Blanc
Hi,

On Wed, 2009-04-29 at 13:18 -0500, Greg Beaver wrote:
 I can get a backtrace using gdb, but no valgrind for
 the apache crash, although I haven't tried running the server via
 valgrind.  Does anyone know if this is even possible to do with a
 forking server?

Yes, you can try with valgrind apache2 -X. You can also run the
FastCGI sapi under valgrind or gdb and make apache connect to it (so
that you debug only php):
USE_ZEND_ALLOC=0 valgrind php-cgi -b127.0.0.1:1234.

Regards,

Arnaud



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/phar phar.c phar_internal.h phar_object.c tar.c util.c zip.c

2009-04-28 Thread Greg Beaver
cellog  Wed Apr 29 03:24:27 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/phar   phar.c phar_internal.h phar_object.c tar.c util.c 
zip.c 
  Log:
  MFPECL: fix PECL bug #16338, php_stream_copy_to_stream{,_ex}()
  http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.370.2.58r2=1.370.2.59diff_format=u
Index: php-src/ext/phar/phar.c
diff -u php-src/ext/phar/phar.c:1.370.2.58 php-src/ext/phar/phar.c:1.370.2.59
--- php-src/ext/phar/phar.c:1.370.2.58  Fri Feb 20 05:06:37 2009
+++ php-src/ext/phar/phar.c Wed Apr 29 03:24:26 2009
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: phar.c,v 1.370.2.58 2009/02/20 05:06:37 cellog Exp $ */
+/* $Id: phar.c,v 1.370.2.59 2009/04/29 03:24:26 cellog Exp $ */
 
 #define PHAR_MAIN 1
 #include phar_internal.h
@@ -1635,7 +1635,7 @@
 
php_stream_filter_append(temp-writefilters, 
filter);
 
-   if (0 == php_stream_copy_to_stream(fp, temp, 
PHP_STREAM_COPY_ALL)) {
+   if (SUCCESS != phar_stream_copy_to_stream(fp, 
temp, PHP_STREAM_COPY_ALL, NULL)) {
if (err) {
php_stream_close(temp);
MAPPHAR_ALLOC_FAIL(unable to 
decompress gzipped phar archive \%s\, ext/zlib is buggy in PHP versions older 
than 5.2.6)
@@ -1677,7 +1677,7 @@
 
php_stream_filter_append(temp-writefilters, 
filter);
 
-   if (0 == php_stream_copy_to_stream(fp, temp, 
PHP_STREAM_COPY_ALL)) {
+   if (SUCCESS != phar_stream_copy_to_stream(fp, 
temp, PHP_STREAM_COPY_ALL, NULL)) {
php_stream_close(temp);
MAPPHAR_ALLOC_FAIL(unable to 
decompress bzipped phar archive \%s\ to temporary file)
}
@@ -2661,7 +2661,7 @@
size_t written;
 
if (!user_stub  phar-halt_offset  oldfile  
!phar-is_brandnew) {
-   written = php_stream_copy_to_stream(oldfile, newfile, 
phar-halt_offset);
+   phar_stream_copy_to_stream(oldfile, newfile, 
phar-halt_offset, written);
newstub = NULL;
} else {
/* this is either a brand new phar or a default stub 
overwrite */
@@ -2849,7 +2849,7 @@
return EOF;
}
php_stream_filter_append((entry-cfp-writefilters), filter);
-   if (entry-uncompressed_filesize != 
php_stream_copy_to_stream(file, entry-cfp, entry-uncompressed_filesize)) {
+   if (SUCCESS != phar_stream_copy_to_stream(file, entry-cfp, 
entry-uncompressed_filesize, NULL)) {
if (closeoldfile) {
php_stream_close(oldfile);
}
@@ -3059,7 +3059,7 @@
/* this will have changed for all files that have either 
changed compression or been modified */
entry-offset = entry-offset_abs = offset;
offset += entry-compressed_filesize;
-   wrote = php_stream_copy_to_stream(file, newfile, 
entry-compressed_filesize);
+   phar_stream_copy_to_stream(file, newfile, 
entry-compressed_filesize, wrote);
 
if (entry-compressed_filesize != wrote) {
if (closeoldfile) {
@@ -3207,7 +3207,7 @@
}
 
php_stream_filter_append(phar-fp-writefilters, 
filter);
-   php_stream_copy_to_stream(newfile, phar-fp, 
PHP_STREAM_COPY_ALL);
+   phar_stream_copy_to_stream(newfile, phar-fp, 
PHP_STREAM_COPY_ALL, NULL);
php_stream_filter_flush(filter, 1);
php_stream_filter_remove(filter, 1 TSRMLS_CC);
php_stream_close(phar-fp);
@@ -3216,14 +3216,14 @@
} else if (phar-flags  PHAR_FILE_COMPRESSED_BZ2) {
filter = php_stream_filter_create(bzip2.compress, 
NULL, php_stream_is_persistent(phar-fp) TSRMLS_CC);
php_stream_filter_append(phar-fp-writefilters, 
filter);
-   php_stream_copy_to_stream(newfile, phar-fp, 
PHP_STREAM_COPY_ALL);
+   phar_stream_copy_to_stream(newfile, phar-fp, 
PHP_STREAM_COPY_ALL, NULL);
php_stream_filter_flush(filter, 1);
php_stream_filter_remove(filter, 1 TSRMLS_CC);
php_stream_close(phar-fp);
/* use the temp stream as our base */
phar-fp = newfile;
} else {
-   php_stream_copy_to_stream(newfile, phar-fp, 
PHP_STREAM_COPY_ALL);
+