Req #57473 [Opn->Nab]: Be able to use magic-info from package shared-mime-info

From: Date: Wed, 11 Oct 2017 17:17:45 +0000
Subject: Req #57473 [Opn->Nab]: Be able to use magic-info from package shared-mime-info
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211629@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=57473&edit=1 ID: 57473 Updated by: ab@php.net Reported by: motin at demomusic dot nu Summary: Be able to use magic-info from package shared-mime-info -Status: Open +Status: Not a bug Type: Feature/Change Request -Package: Fileinfo +Package: *General Issues Operating System: Linux PHP Version: 5.2.0 RC4 Block user comment: N Private report: N New Comment: Closing as per request. But also to mention is - external magic files are versioned, so loading some version not matching current ext version won't work. Thanks. Previous Comments: ------------------------------------------------------------------------ [2017-07-04 07:23:28] motin at demomusic dot nu Please close this ancient and inaccurate bug report, I've lost the password. (This works as it should nowadays and may have worked a decade ago, when I first reported the bug, but was a lot less experienced :) ) ------------------------------------------------------------------------ [2007-10-04 10:47:35] joungkyun at gmail dot com if /path/to/updated/files/magic is soft link, fix it follow patch. This is clearly bug. :-( I want to fix it. diff -urNp fileinfo.org/fileinfo.c fileinfo/fileinfo.c --- fileinfo.org/fileinfo.c 2006-11-08 06:18:51.000000000 +0900 +++ fileinfo/fileinfo.c 2007-10-04 23:22:43.000000000 +0900 @@ -260,12 +260,12 @@ PHP_FUNCTION(finfo_open) RETURN_FALSE; } - if (file_len) { /* user specified filed, perform open_basedir checks */ - if (!VCWD_REALPATH(file, resolved_path)) { - RETURN_FALSE; - } - file = resolved_path; + if (!VCWD_REALPATH(file, resolved_path)) { + RETURN_FALSE; + } + file = resolved_path; + if (file_len) { /* user specified filed, perform open_basedir checks */ if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) { RETURN_FALSE; } ------------------------------------------------------------------------ [2007-01-10 10:52:05] motin at demomusic dot nu Description: ------------ Fileinfo should be able to use not only the magic-file supplied by Apache or the libmagic magic-file but also the magic-info included with the package shared-mime-info from freedesktop.org The files currently generated by shared-mime-info's update-mime-database are stored in binary form and trying to link to any of these files as the magic file yields the error: finfo_open(): Failed to load magic database at '/path/to/updated/files/magic'. in ... The same error is produced when trying any other of the updated files, as well as trying a copy of "magic" renamed to "magic.mime" (Needed for fileinfo ta accept the /etc/apache2/magic file earlier) Using the shared-mime-info magic-info would allow fileinfo to detect a lot more mimetypes more exactly. http://forums.devshed.com/php-development-5/how-do-i-use-magic-file-from-shared-mime-info-with-fileinfo-415722.html#post1711168 Reproduce code: --------------- $finfo = finfo_open(FILEINFO_MIME, "/path/to/updated/files/magic"); Expected result: ---------------- No errors, fileinfo object loading successsfully ready to be used. Actual result: -------------- finfo_open(): Failed to load magic database at '/path/to/updated/files/magic'. in ... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=57473&edit=1

« previous php.bugs (#211629) next »