Bug #61482 [Opn]: php-cli crashes during 'nmake snap'

From: Date: Fri, 23 Mar 2012 05:24:54 +0000
Subject: Bug #61482 [Opn]: php-cli crashes during 'nmake snap'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-168745@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61482&edit=1

 ID:                 61482
 Updated by:         stas@php.net
 Reported by:        mattficken@php.net
 Summary:            php-cli crashes during 'nmake snap'
 Status:             Open
 Type:               Bug
 Package:            PHAR related
 Operating System:   Windows
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

git bisect says commit 714f1ff4b37c5101b3c61ea108a3d415f41e50df is to blame. 
Reverting it seems to fix the issue.


Previous Comments:
------------------------------------------------------------------------
[2012-03-23 05:24:11] mattficken@php.net

With proper quotes:


Release\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php 
"Release" "C:\Projects\win32build" "php5.dll" "php-cgi.exe
php.exe" "php_intl.dll 
php_pdo_mysql.dll " " " "no"

------------------------------------------------------------------------
[2012-03-23 05:23:06] stas@php.net

This commandline reliably reproduces it:


Release\php.exe -d date.timezone=UTC -n -dphar.readonly=0 win32/build/mkdist.php 
Release C:\Projects\win32build php5.dll php-cgi.exe php.exe php_intl.dll 
php_pdo_mysql.dll    no

------------------------------------------------------------------------
[2012-03-23 00:47:31] stas@php.net

Happens to me with 5.4 branch too. If I remove make_phar_dot_phar(), it does not 
happen, so definitely has something to do with phar.

------------------------------------------------------------------------
[2012-03-22 23:03:38] mattficken@php.net

looks like it fails on the first call to file_get_contents() in make_phar_dot_phar().

the first and only arg to file_get_contents() is
"c:\php-sdk\git\php-src\ext\phar\phar\clicommand.inc".

------------------------------------------------------------------------
[2012-03-22 22:56:48] mattficken@php.net

Test Script (stripped down win32/build/mkdist.php):
<?php 

// FYI: nmake snap runs mkdist.php with these args
//
// c:\php-sdk\git\php-src>C:\php-sdk\git\obj\Release\php.exe -d date.timezone=UTC -n
-dphar.readonly=0 win32/build/mkdist.php "C:\php-sdk\git\obj\Release"
"C:\php-sdk\git\php-src\no" "php5.dll" "php-cgi.exe php.exe php-win.exe
php5embed.lib" "php_mbstring.dll php_shmop.dll php_sockets.dll php_sqlite3.dll
php_exif.dll php_pdo_mysql.dll php_pdo_odbc.dll php_pdo_sqlite.dll " " "
"no"

// php build directory
$build_dir = "C:\php-sdk\git\obj\Release";

$dist_dir = $build_dir . "/php-" . phpversion();
$test_dir = $build_dir . "/php-test-pack-" . phpversion();
$pecl_dir = $build_dir . "/pecl-" . phpversion();

@mkdir($dist_dir);
@mkdir("$dist_dir/ext");
@mkdir("$dist_dir/dev");
@mkdir("$dist_dir/extras");
@mkdir($pecl_dir);


function make_phar_dot_phar($dist_dir)
{
	if (!extension_loaded('phar')) {
		return;
	}

	$path_to_phar = realpath(__DIR__ . '/../../ext/phar');

	echo "Generating pharcommand.phar\n";
	$phar = new Phar($dist_dir . '/pharcommand.phar', 0, 'pharcommand');

	foreach (new DirectoryIterator($path_to_phar . '/phar') as $file) {
		if ($file->isDir() || $file == 'phar.php') {
			continue;
		}

		echo 'adding ', $file, "\n";
		$phar[(string) $file] = file_get_contents($path_to_phar.  '/phar/' . $file);
	}

	$phar->setSignatureAlgorithm(Phar::SHA1);
	$stub = file($path_to_phar . '/phar/phar.php');

	unset($stub[0]); // remove hashbang
	$phar->setStub(implode('', $stub));

	echo "Creating phar.phar.bat\n";
	file_put_contents($dist_dir . '/phar.phar.bat', "%~dp0php.exe %~dp0pharcommand.phar
%*\r\n");
}


make_phar_dot_phar($dist_dir);
?>

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=61482


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61482&edit=1


Thread (8 messages)

« previous php.bugs (#168745) next »