| Summary: | magic_buffer doesn't recognize mp3 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Stanislav Oginsky <stas.oginsky> | ||||
| Component: | file | Assignee: | Jan Kaluža <jkaluza> | ||||
| Status: | CLOSED NOTABUG | QA Contact: | BaseOS QE Security Team <qe-baseos-security> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 6.1 | ||||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2011-11-08 08:07:28 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Attachments: |
|
||||||
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. If you would like it considered as an exception in the current release, please ask your support representative. What's exactly "file" package version you have? The version is: file.x86_64 5.04-9.el6 Hm, I was trying to reproduce it and some not-working mp3 file would help me. Created attachment 532013 [details]
requested mp3 file
The file is enclosed.
What sox version do you have? My test app detects it properly. I have never used sox, but as far as I understand, official sox in RHEL does not have MP3 support. Sox has smart system of detection, if file has extension sox will detect it, but it won't use magic, please remove the extension and try again.
sox -V6 --magic Vanishing -n
However even if you don't do so you may see that format wasn't detected:
> sox -V6 --magic Vanishing -n
sox: SoX v14.3.2
time: Jun 29 2011 11:20:29
gcc: 4.4.5 20110214 (Red Hat 4.4.5-6)
arch: 1288 48 88 L OMP
sox DBUG formats: libmagic detected application/octet-stream; charset=binary
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sox FAIL formats: can't determine type of file `Vanishing'
And SoX 14.3.2 has magic support.
Moreover it does detect the format if magic_file is used instead of magic_buffer.
Please inform me if you need additional information.
You are not using sox from RHEL6 or Fedora, because it's not compiled with libmagic support and it's also not version 14.3.2. However, I've checked the code of 14.3.2 and it passes only 256 bytes of file to magic_buffer function, which is not enough. It should pass 4096 bytes there. I've successfully reproduced it with my test script. So, in sox in formats.c, there should be: #define AUTO_DETECT_SIZE 4096 instead of #define AUTO_DETECT_SIZE 256 Since this is not File bug and it also doesn't affect RHEL/Fedora sox packages (because there's no libmagic support in them), I will close it as NOTABUG. If you're familiar with sox upstream, you can submit it as a bug there. |
Description of problem: I have found that "sox" utility that is consumer of "file" (libmagic) can't recognize mp3 files via magic_buffer. The issue however appears in file-5.0.4 but is not reproducible using file-4.17 How reproducible: It is reproducible for some mp3 files (not all of them). Just use some mp3 file and try to get it's file type by using magic_buffer and magic_file: The example is like: === filetype_file = magic_file(magic, "filename"); if (filetype_file) printf("FILE: %s\n", filetype_file); if (magic) filetype = magic_buffer(magic, data, len); if (filetype) printf("BUFFER: %s\n", filetype); === Actual results: It does determine the file type with magic_file only. With file-4.17 it determine file type with both. Expected results: To get correct file type using magic_buffer. Additional info: My mp3 info extracted using sox: === arch: 1288 48 88 L OMP sox INFO formats: detected file format type `audio/mpeg' sox DBUG mp3-duration: got exact duration from XING frame count (3854) Input File : 'Vanishing.mp3' Channels : 2 Sample Rate : 44100 Precision : 16-bit Duration : 00:01:40.68 = 4439768 samples = 7550.63 CDDA sectors File Size : 3.39M Bit Rate : 269k Sample Encoding: MPEG audio (layer I, II or III) Output File : '' (null) Channels : 2 Sample Rate : 44100 Precision : 16-bit Duration : 00:01:40.68 = 4439768 samples = 7550.63 CDDA sectors sox INFO sox: effects chain: input 44100Hz 2 channels 16 bits (multi) sox INFO sox: effects chain: output 44100Hz 2 channels 16 bits (multi) === Please inform me if additional information is required and if I should send you mp3 file for test. Thank you in advance.