FS#70261 - [file] file 5.40 reports incorrect compressed-encoding for xz files

Attached to Project: Arch Linux
Opened by A. Bosch (progandy) - Friday, 02 April 2021, 12:46 GMT
Last edited by Sébastien Luttringer (seblu) - Monday, 10 May 2021, 12:12 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Sébastien Luttringer (seblu)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 7
Private No

Details

Description:

File v5.40 displays incorrect an incorrect mime type for xz compressed files.
This causes a problem with makepkg not being able to decrompress plain xz compressed source-files.
See: https://bbs.archlinux.org/viewtopic.php?id=265115

Additional info:
* package version(s)
file 5.40-1

Steps to reproduce:

$ file -v
file-5.40
magic file from /usr/share/file/misc/magic
seccomp support included
$ echo "test" | xz - >test.xz
$ file -b test.xz
XZ compressed data, checksum CRC64
$ file -bi test.xz
application/octet-stream; charset=binary

Correct output with version 5.39:
$ file -v
file-5.39
magic file from /usr/share/file/misc/magic
seccomp support included
$ echo "test" | xz - >test.xz
$ file -b test.xz
XZ compressed data
$ file -bi test.xz
application/x-xz; charset=binary

Attached is a patch that seems to fix it, the output seems to be correct:
$ ./src/file -v -m magic/magic.mgc
lt-file-5.40
... (compiled from git tag FILE5_40 with my patch)
$ ./src/file -S -bizL -m magic/magic.mgc test.xz
text/plain; charset=us-ascii compressed-encoding=application/x-xz; charset=binary
$ ./src/file -S -bzL -m magic/magic.mgc test.xz
ASCII text (XZ compressed data, checksum CRC64)
This task depends upon

Closed by  Sébastien Luttringer (seblu)
Monday, 10 May 2021, 12:12 GMT
Reason for closing:  Fixed
Additional comments about closing:  file-5.40-3
Comment by Chris Severance (severach) - Thursday, 08 April 2021, 17:52 GMT Comment by Sébastien Luttringer (seblu) - Monday, 12 April 2021, 16:25 GMT
Package file-5.40-2 revert the commit 3ebd747de661b244f1acec29495d676dd52e71d5 and is in [testing].
Comment by Jelle van der Waa (jelly) - Monday, 10 May 2021, 10:33 GMT
This now breaks diffoscope tests as it removes the "checksum CRC64" out, and upstream didn't revert this commit so isn't https://github.com/file/file/commit/9b0459afab309a82aa4e46f73a4e50dd641f3d39 the correct fix? I can't tell from the bugtracker what is the correct fix.
Comment by A. Bosch (progandy) - Monday, 10 May 2021, 10:40 GMT
The upstream commit 9b0459af is the correct fix. It does the same as the patch I proposed in this bug report and fedora has cherry-picked that commit as well:
https://bugzilla.redhat.com/show_bug.cgi?id=1947317
https://src.fedoraproject.org/rpms/file/pull-request/9
Comment by Sébastien Luttringer (seblu) - Monday, 10 May 2021, 12:11 GMT
Looks like 9b0459afab309a82aa4e46f73a4e50dd641f3d39 is the fix. Will be rolled in file-5.40-3. Thanks both of you.

Loading...