Hi Steven,
- What does ‘file -i’ give on the MP3 file?
...Aha! You nailed it:
$ file -i /tmp/session2.mp3
/tmp/session2.mp3: audio/mpegapplication/octet-stream; charset=binary
...and similarly,
$ file --mime-type /tmp/session2.mp3
/tmp/session2.mp3: audio/mpegapplication/octet-stream
Yes, that look non-optimal.
With no options, file reports
$ file /tmp/session2.mp3
/tmp/session2.mp3: Audio file with ID3 version 2.4.0, contains:MPEG ADTS,
layer III, v1, 64 kbps, 48 kHz, Stereo
Its order of tests can give strange results. :-)
$ file $f
steelers_wheel__stuck_in_the_middle_with_you.mp3: GEM GDOS font 50304, ID
0xf3ff
$ file -i $f
steelers_wheel__stuck_in_the_middle_with_you.mp3: application/x-font-gdos;
charset=binary
Running strace on file lists the following openat() calls:
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libmagic.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libseccomp.so.2", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libbz2.so.1.0", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, 0x555892c2d4f0, O_RDONLY) = 3
openat(AT_FDCWD, 0x153f7cb54848, O_RDONLY) = -1 ENOENT (No such file or
directory)
openat(AT_FDCWD, 0x7ffc2a816a10, O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, 0x7ffc2a819209, O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 3
...which includes none of the files I expected to see.
Interesting lines from ‘strace -fe %file’ here are
execve("/usr/bin/file", ["file", "-i",
"/home/music/youtube/steelers_whe"...], 0x7ffcf3fa2500 /* 70 vars */) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
...
openat(AT_FDCWD, "/usr/lib/libmagic.so.1", O_RDONLY|O_CLOEXEC) = 3
...
stat("/home/ralph/.magic.mgc", 0x7ffd781d5190) = -1 ENOENT (No such file or
directory)
stat("/home/ralph/.magic", 0x7ffd781d5190) = -1 ENOENT (No such file or
directory)
access("/usr/share/file/misc/magic.mime.mgc", R_OK) = -1 ENOENT (No such
file or directory)
openat(AT_FDCWD, "/usr/share/file/misc/magic.mgc", O_RDONLY) = 3
so there's still something I'm obviously missing.
I think it's a file(1) bug in the executable, probably known and fixed
upstream. What system are you running, e.g. Ubuntu, and its version?
--
Cheers, Ralph.