#46331 [Opn->Fbk]: Fileinfo does not look for /usr/share/magic{.*} and coredumps

From: Date: Sat, 18 Oct 2008 18:19:56 +0000
Subject: #46331 [Opn->Fbk]: Fileinfo does not look for /usr/share/magic{.*} and coredumps
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129824@lists.php.net to get a copy of this message
ID: 46331 Updated by: scottmac@php.net Reported By: Bjorn dot Wiberg at its dot uu dot se -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: IBM AIX 5.3 (5300-08-01-0819) PHP Version: 5.3CVS-2008-10-17 (snap) New Comment: Any chance of a full backtrace? bt full I can't reproduce this on OS X or CentOS. Previous Comments: ------------------------------------------------------------------------ [2008-10-17 14:57:30] Bjorn dot Wiberg at its dot uu dot se Description: ------------ The (5.3dev200810170630) bundled Fileinfo extension does not look for /usr/share/misc/magic{.*} as suggested by http://se.php.net/manual/en/function.finfo-open.php. Setting the environment variable MAGIC works, however. So does specifying the full path to to magic file in the call to finfo_open(). When it fails to find the magic file, PHP core dumps. Reproduce code: --------------- php -d extension_dir=/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' Also see "Actual result" below, which illustrates all this. Expected result: ---------------- No coredump, Actual result: -------------- root@musica-lp03:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' Segmentation fault (core dumped) root@musica-lp03:/# gdb /nynom/apache/php/bin/php ./core GNU gdb 6.0 Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-ibm-aix5.1.0.0"... Core was generated by `php'. Program terminated with signal 11, Segmentation fault. #0 0x107ca694 in bs1 (Illegal instruction (core dumped) root@musica-lp03:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME, "/usr/local/share/file/magic");' (OK) root@musica-lp03:/# export MAGIC=/usr/local/share/file/magic root@musica-lp03:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' root@musica-lp03:/# (OK) root@musica-lp03:/# cd /usr/share/ root@musica-lp03:/usr/share# mkdir misc root@musica-lp03:/usr/share# cd misc/ root@musica-lp03:/usr/share/misc# ln -s /usr/local/share/file/magic* . root@musica-lp03:/usr/share/misc# ls -l total 0 lrwxrwxrwx 1 root system 27 2008-10-17 16:52 magic -> /usr/local/share/file/magic lrwxrwxrwx 1 root system 31 2008-10-17 16:52 magic.mgc -> /usr/local/share/file/magic.mgc lrwxrwxrwx 1 root system 32 2008-10-17 16:52 magic.mime -> /usr/local/share/file/magic.mime lrwxrwxrwx 1 root system 36 2008-10-17 16:52 magic.mime.mgc -> /usr/local/share/file/magic.mime.mgc root@musica-lp03:/usr/share/misc# cd root@musica-lp03:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' root@musica-lp03:/# unset MAGIC root@musica-lp03:/# export MAGIC root@musica-lp03:/# /nynom/apache/php/bin/php -d extension_dir=/nynom/apache/php/lib/php/extensions/debug-non-zts-20071006 -r '$finfo=finfo_open(FILEINFO_MIME);' Segmentation fault (core dumped) Fileinfo information from phpinfo(): fileinfo fileinfo support enabled version 1.0.5-dev ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46331&edit=1

« previous php.bugs (#129824) next »