Bug 456798 - Failed to load magic database at '/usr/share/file/magic' after each update of "file" package
Failed to load magic database at '/usr/share/file/magic' after each update of...
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: php-pecl-Fileinfo (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Remi Collet
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-07-27 07:10 EDT by Robert Scheck
Modified: 2012-08-16 17:53 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-16 17:53:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Robert Scheck 2008-07-27 07:10:34 EDT
Description of problem:
At first I'm using php-pecl-Fileinfo-1.0.4-3, because the PHP internal similar
function was dropped by Joe already a longer time ago, as it seems to be 
obsoleted by PHP upstream. But for me, the php-pecl-Fileinfo seems to be *very* 
buggy: Yesterday afternoon I did the update from file-4.24-4 to file-4.25-1,
did no restart of httpd and *all* my PHP scripts using php-pecl-Fileinfo failed
with the following:

[Sat Jul 26 18:29:47 2008] [error] [client 192.168.0.1] PHP Warning: 
finfo_open() [<a href='function.finfo-open'>function.finfo-open</a>]: Failed to
load magic database at '/usr/share/file/magic'. in functions.php on line 413,
referer: http://localhost/one-tarball.tar.gz
[Sat Jul 26 18:29:47 2008] [error] [client 192.168.0.1] PHP Warning: 
finfo_file(): supplied argument is not a valid file_info resource in
functions.php on line 414, referer: http://localhost/one-tarball.tar.gz
[Sat Jul 26 18:29:47 2008] [error] [client 192.168.0.1] PHP Warning: 
finfo_close(): supplied argument is not a valid file_info resource in
functions.php on line 415, referer: http://localhost/one-tarball.tar.gz

Interestingly, the file it complains about exists:

-rw-r--r-- 1 root root 527569 26. Jul 14:00 /usr/share/file/magic

And the error did not happen during the RPM update, where the file maybe was
missing, but all the time after, was reproducible for me. Then, I tried a 
restart of httpd and things started to get working again *arghl* What the fuck
breaks php-pecl-Fileinfo here?

The code I'm using is very simple (according to the lines from the error_log):

function download_file($file)
{
  if(is_readable($file))
  {
    header("Pragma: no-cache");
    $finfo = finfo_open(FILEINFO_MIME);
    header("Content-Type: " . finfo_file($finfo, $file));
    finfo_close($finfo);
    header("Content-Length: " . filesize($file));
    readfile($file);
  }
  else
  {
    die("Error: ...");
  }
}

Version-Release number of selected component (if applicable):
php-5.2.6-2
file-4.24-4
file-4.25-1
php-pecl-Fileinfo-1.0.4-3

How reproducible:
Everytime, see above.

Actual results:
Each update of file breaks php-pecl-Fileinfo until httpd is restarted.

Expected results:
No breakings and odd things as in times as mimetype detection was PHP core-
internal.

Additional info:
I'm adding all maintainers of file, php and php-pecl-Fileinfo here, maybe we
can get to gether a solution, fix or whatelse. The problem also happend for me
with the previous file upgrade from 4.23 to 4.24 or what it was. But there I
unfortunately wasn't able to locate the problem that exactly.
Comment 1 Tomas Smetana 2008-07-28 03:44:45 EDT
Seems that finfo_close doesn't call magic_close, so the magic database remains
opened until the php-pecl-Fileinfo destructor is called.  I don't know much
about php internals so I can't say whether this is a bug or not.
Comment 2 Joe Orton 2008-07-30 12:18:03 EDT
Can you reproduce this by doing something as simple as:

mv /usr/share/file/magic{,.foo}
cp /usr/share/file/magic{.foo,}
Comment 3 Robert Scheck 2008-07-30 13:48:50 EDT
No, unfortunately not. As it seems, it happens only if the magic file itself 
changes somehow, e.g. through an update (before/after):

-rw-r--r--    1 root    root           518521 Jun  7 15:52 /usr/share/file/magic
-rw-r--r--    1 root    root           527569 Jul 26 14:00 /usr/share/file/magic

I could imagine something like, that the magic file is read, positions or some
offsets are hold in memory somewhere and once the magic file changes, positions,
offsets or whatelse is used to locate what is needed from magic file doesn't fit
any longer. And as Tomas wrote, the magic database remains still open...IMHO this
should be the case in PHP.
Comment 4 Bug Zapper 2008-11-25 21:36:15 EST
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 5 Robert Scheck 2009-05-10 19:20:09 EDT
Ping?
Comment 6 Bug Zapper 2009-06-09 05:38:53 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 7 Bug Zapper 2010-04-27 08:10:00 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 8 Robert Scheck 2010-05-01 11:56:09 EDT
Still affecting Rawhide.
Comment 9 Bug Zapper 2010-07-30 06:32:33 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 10 Fedora End Of Life 2012-08-16 17:53:42 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Note You need to log in before you can comment on or make changes to this bug.