10.12: /usr/bin/file -z gives incomplete MIME type for zipped tarball

Originator:sypholux8595
Number:rdar://26877706 Date Originated:2016-06-18
Status:Closed Resolved:Yes
Product:macOS + SDK Product Version:10.12 Beta (16A201w)
Classification:No Value Reproducible:Always
 
Summary:
Given the `-z` option, the BSD `file` utility does not return the expected `application/x-tar` MIME type anymore. The issue occurs since 10.12 beta. In El Capitan, the command works as intended.

Steps to Reproduce:
1. Open Terminal.

2. Run `cd "$(mktemp -d)" & touch foo & tar cfvz foo.tgz foo`.

3. Run `file -Izb foo.tgz`.

Alternatively, run the shell script attached to this issue report.


Expected Results:
application/x-tar; charset=binary compressed-encoding=application/x-gzip; charset=binary; charset=binary


Actual Results:
application/x-gzip; charset=binary


Version:
macOS Sierra
Version 10.12 Beta (16A201w)

Notes:
Impact:

Users cannot distinguish anymore whether a given archive is a compressed tarball or a compressed set of simple files.

Notes:

We cross-checked against a current FreeBSD install which has version 5.25 of the `file` utility. When following the above steps on FreeBSD, `file` gives the correct result; note that step #3 needs to be substituted with `file -izb foo.tgz` (lower-case `i`) on FreeBSD as some option shorthands differ between Apple’s fork and the BSD original.


Configuration:


Attachments:
'test_case.sh' was successfully uploaded.

Comments

Apple has responded, and asked me to re-test with macOS Sierra 10.12.5. The file command now behaves as expected.

By sypholux8595 at June 29, 2017, 1:15 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!