Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 353392 - dev-lang/php-5.3.5 and -r1 emerge fails with sandbox violation if log file is configured
Summary: dev-lang/php-5.3.5 and -r1 emerge fails with sandbox violation if log file is...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-01 12:19 UTC by Andreas Prieß
Modified: 2012-01-14 11:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Prieß 2011-02-01 12:19:43 UTC
emerge of dev-lang/php-5.3.5 and dev-lang/php-5.3.5-r1 fails with "ACCESS VIOLATION" trying to access configured log file in /var/log/php.log.

Somehow while emerging the configuration files under /etc/php/ are used. If php is configured there to log to a file, then the ebuild fails with an access violation.

Reproducible: Always

Steps to Reproduce:
1. configure php to log to a file in /var/log/ 
2. emerge php


Actual Results:  
emerge fails:
--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE "/var/log/sandbox/sandbox-23958.log"

VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: open_wr
S: deny
P: /var/log/php.log
A: /var/log/php.log
R: /var/log/php.log
C: php -C -q -d include_path=/usr/share/php -d output_buffering=1 -d memory_limit=32M -d variables_order=EGPCS -d open_basedir= -d safe_mode=0 -d register_argc_argv=On -d auto_prepend_file= -d auto_append_file= /usr/share/php/pearcmd.php -q info PHP_Archive

F: open_wr
S: deny
P: /var/log/php.log
A: /var/log/php.log
R: /var/log/php.log
C: php -C -q -d include_path=/usr/share/php -d output_buffering=1 -d memory_limit=32M -d variables_order=EGPCS -d open_basedir= -d safe_mode=0 -d register_argc_argv=On -d auto_prepend_file= -d auto_append_file= /usr/share/php/pearcmd.php -q info PHP_Archive
--------------------------------------------------------------------------------

>>> Failed to emerge dev-lang/php-5.3.5-r1, Log file:

>>>  '/var/log/portage/dev-lang:php-5.3.5-r1:20110201-105730.log'


Expected Results:  
Configuration under /etc/php/ should not be used or logging should be disabled in the ebuild for the relevant step.
Comment 1 Andreas Prieß 2011-02-01 12:22:20 UTC
And to work around, of course, if the configurations under /etc/php/ are changed to not log to a file then the ebuild works as expected.
Comment 2 Andreas Prieß 2011-02-01 12:27:40 UTC
The relevant configuration in php.ini that causes the ebuild to fail for me would be:
log_errors = On
error_log = /var/log/php.log

But the ebuild should not depend on the currently deployed local configuration.
Comment 3 Andreas Prieß 2011-02-01 14:03:51 UTC
When I create a symbolic link in /etc/php/* like
php.ini -> php.ini.original
the link is removed and replaced with a new php.ini.

Shouldn't this be left to the etc-update process?
Comment 4 Ole Markus With (RETIRED) gentoo-dev 2011-02-13 19:53:41 UTC
It seems like somewhere in the build process, /usr/bin/pear is executed. Either I will have to track down where this is happening and why (my guess is that it is something related to phar), or I will have to force logging to off in the pear script. 

As far as I can tell, it only happens when logging is enabled for the cli SAPI.
Comment 5 Andreas Prieß 2011-02-14 10:10:23 UTC
For me this happens not only for the cli SAPI, but also for cgi and apache2.

Here are my php use-flags on one host, also happens with cgi instead of apache2 enabled:

dev-lang/php-5.3.5-r1  USE="apache2 bcmath bzip2 calendar cli crypt ctype curl doc fileinfo filter ftp gd hash iconv imap ipv6 json mhash mysql mysqli nls phar posix postgres readline session simplexml sockets ssl suhosin threads tidy truetype unicode xml xmlreader xmlwriter xsl zip zlib -adabas -berkdb -birdstep -cdb -cgi -cjk -curlwrappers -db2 -dbmaker -debug -embed -empress -empress-bcs -enchant -esoob -exif -firebird -flatfile -fpm -frontbase -gd-external -gdbm -gmp -inifile -interbase -intl -iodbc -kerberos -kolab -ldap -ldap-sasl -libedit -mssql -mysqlnd -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -qdbm -recode -sapdb -sharedext -sharedmem -snmp -soap -solid -spell -sqlite -sqlite3 -sybase-ct -sysvipc -tokenizer -wddx -xmlrpc -xpm"


A bit more of the emerge output, just tell me if more info is needed:


Build complete.
Don't forget to run 'make test'.

make -j3 INSTALL_ROOT=/var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis/apache2/ install-sapi 
exit 0; -b -o /var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis-build/apache2/ext/phar/phar_path_check.c /var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis-build/apache2/ext/phar/phar_path_check.re
Installing PHP SAPI module:       apache2handler
/usr/lib/apache2/build/instdso.sh SH_LIBTOOL='/usr/bin/libtool' libphp5.la /var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis/apache2//usr/lib/apache2/modules
/usr/bin/libtool --mode=install cp libphp5.la /var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis/apache2//usr/lib/apache2/modules/
libtool: install: cp .libs/libphp5.so /var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis/apache2//usr/lib/apache2/modules/libphp5.so
libtool: install: cp .libs/libphp5.lai /var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis/apache2//usr/lib/apache2/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis-build/apache2/libs'
chmod 755 /var/tmp/portage/dev-lang/php-5.3.5-r1/work/sapis/apache2//usr/lib/apache2/modules/libphp5.so
>>> Source compiled.
--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE "/var/log/sandbox/sandbox-6118.log"

VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: open_wr
S: deny
P: /var/log/php.log
A: /var/log/php.log
R: /var/log/php.log
C: php -C -q -d include_path=/usr/share/php -d output_buffering=1 -d memory_limit=32M -d variables_order=EGPCS -d open_basedir= -d safe_mode=0 -d register_argc_argv=On -d auto_prepend_file= -d auto_append_file= /usr/share/php/pearcmd.php -q info PHP_Archive 

F: open_wr
S: deny
P: /var/log/php.log
A: /var/log/php.log
R: /var/log/php.log
C: php -C -q -d include_path=/usr/share/php -d output_buffering=1 -d memory_limit=32M -d variables_order=EGPCS -d open_basedir= -d safe_mode=0 -d register_argc_argv=On -d auto_prepend_file= -d auto_append_file= /usr/share/php/pearcmd.php -q info PHP_Archive 
--------------------------------------------------------------------------------
Comment 6 Ole Markus With (RETIRED) gentoo-dev 2011-02-14 10:41:42 UTC
Yea, but it only happens when the cli SAPI has logging configured, right? Regardless of what other SAPIs get installed.
Comment 7 Ole Markus With (RETIRED) gentoo-dev 2011-04-23 16:26:55 UTC
Sorry, but we simply cannot support enabling logging to file for the cli SAPI. This will not only break merging PHP, but also break merging any other package that makes use of PHP.

If you really need logging from cli, I recommend using -c to make use of an alternative php.ini file.

Cheers,
Ole Markus
Comment 8 Patrick ALLAERT 2011-11-18 09:30:57 UTC
Really can't fix?

The solution should be to call php with -d error_log= without providing a parameter.
Comment 9 Ole Markus With (RETIRED) gentoo-dev 2011-11-18 11:03:25 UTC
True. If you can give me a patch, I can add it. I never figured out exactly where (and why) php is being executed in the first place.
Comment 10 Matti Bickel (RETIRED) gentoo-dev 2011-12-19 23:44:43 UTC
I've been unable to reproduce this bug with current 5.3 and 5.4 ebuilds. Could you try again and see if the problem persists for you?

I've tested with your posted USE-combo on amd64...
Comment 11 Matti Bickel (RETIRED) gentoo-dev 2012-01-14 11:10:35 UTC
Please reopen when the problem persists with the current ebuilds. It currently works for me.