php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57068 incorrect detection of magic file (/usr/share/misc/file)
Submitted: 2006-06-08 03:32 UTC Modified: 2006-11-07 16:28 UTC
From: zaa at zaa dot pp dot ru Assigned:
Status: Closed Package: Fileinfo (PECL)
PHP Version: 5.1.2 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zaa at zaa dot pp dot ru
New email:
PHP Version: OS:

 

 [2006-06-08 03:32 UTC] zaa at zaa dot pp dot ru
Description:
------------
MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /usr/share/misc/file/magic /etc/magic /usr/share/misc"
has incorrect path for file database in /usr/share/misc folder. Correct line looks as follows:

MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /usr/share/misc/file/magic /etc/magic /usr/share/misc/file"

Supplied patch fixes the issue and improves algorithm of magic file detection.

--- config.m4.orig      Wed May 24 00:48:38 2006
+++ config.m4   Wed May 24 00:51:24 2006
@@ -47,12 +47,15 @@ if test "$PHP_FILEINFO" != "no"; then
     -L$FILEINFO_DIR/lib
   ])

-  MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /usr/share/misc/file/magic /etc/magic /usr/share/misc"
-  for i in $MAGIC_MIME_LOCATIONS; do
-    if test -f $i; then
-       PHP_DEFAULT_MAGIC_FILE=$i
+  MAGIC_MIME_DIRS="/usr/local/share/file /usr/share/file /usr/share/misc/file /etc /usr/share/misc"
+  MAGIC_MIME_FILENAMES="magic magic.mime"
+  for i in $MAGIC_MIME_DIRS; do
+       for j in $MAGIC_MIME_FILENAMES; do
+               if test -f "$i/$j"; then
+                       PHP_DEFAULT_MAGIC_FILE="$i/$j"
        break
     fi
+       done
   done
   AC_DEFINE_UNQUOTED(PHP_DEFAULT_MAGIC_FILE,"$PHP_DEFAULT_MAGIC_FILE",[magic file path])



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-27 04:53 UTC] r dot de dot groen at versatel dot nl
When I try this patch I get the message:
===>  Patching for pecl-fileinfo-1.0.3
===>  Applying FreeBSD patches for pecl-fileinfo-1.0.3
patch: **** malformed patch at line 22: AC_DEFINE_UNQUOTED(PHP_DEFAULT_MAGIC_FILE,"$PHP_DEFAULT_MAGIC_FILE",[magic file path])
=> Patch patch-config.m4 failed to apply cleanly.
*** Error code 1

What's wrong?
 [2006-09-28 06:27 UTC] zaa at zaa dot pp dot ru
As far as I understood you are trying to install pecl-fileinfo-1.0.3 port. The patch (its slightly modified version) is already incorporated into this version of the freebsd port (files/patch-config.m4 file).
 [2006-11-07 16:28 UTC] ilia at prohost dot org
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 19:01:28 2024 UTC