Subject: | oo-api.t fails on OS X 10.9.5 w/ libmagic from homebrew; magic.mgc confusion. |
On a Mac running OS X 10.9.5 with libmagic v5.22 installed via homebrew.
oo-api.t fails the custom file part of the test, where it tries to load /usr/share/file/magic.mgc.
The `$info` returned around line 46 of oo-api.t for that file reports that it is
```
DB<1> x $info
0 HASH(0x7fe03aed5780)
'description' => 'magic binary file for file(1) cmd (version 7) (little endian)'
'encoding' => 'binary'
'mime_type' => 'application/octet-stream'
'mime_with_encoding' => 'application/octet-stream; charset=binary'
DB<2> n
```
but when it is used as the standard_file argument to File::LibMagic->new() it generates the following failures:
```
t/samples/magic, 2: Warning: using regular magic file `/usr/share/file/magic.mgc'
/usr/share/file/magic.mgc, 1: Warning: offset `�' invalid
/usr/share/file/magic.mgc, 1: Warning: type `�' invalid
/usr/share/file/magic.mgc, 2: Warning: offset `Firmware v' invalid
[...]
```
and then the tests fail.
If I replace that magic file with `/usr/local//Cellar/libmagic/5.22/share/misc/magic.mgc` then `$info` is
```
DB<1> x $info
0 HASH(0x7fa75402c950)
'description' => 'magic binary file for file(1) cmd (version 12) (little endian)'
'encoding' => 'binary'
'mime_type' => 'application/octet-stream'
'mime_with_encoding' => 'application/octet-stream; charset=binary'
DB<2> n
```
and the tests all pass.
It seems that the homebrew installed library does not work with the system magic.mgc file.
Given that the path to the magic.mgc file that work contains the releases version number, I'm not sure how to best proceed.
My best idea is to work with the homebrew port and have it link its magic.mgc file somewhere underneath /usr/share then have t/oo-api.t use it a) in preference to the one in /usr/share, or b) if it's running on a mac or c) based on an environment variable or....
What can I do to help get this cleaned up?
Thanks!