RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1488898 - g-zip archives are not always recognized by "file"
Summary: g-zip archives are not always recognized by "file"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: file
Version: 7.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: Karel Volný
URL:
Whiteboard:
Depends On:
Blocks: 1420851 1546815 1549617 1549689 1551061 1609081
TreeView+ depends on / blocked
 
Reported: 2017-09-06 12:33 UTC by Renaud Métrich
Modified: 2021-12-10 15:14 UTC (History)
6 users (show)

Fixed In Version: file-5.11-34.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2018-10-30 08:09:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3173301 0 None None None 2017-09-07 00:03:10 UTC
Red Hat Product Errata RHBA-2018:3079 0 None None None 2018-10-30 08:10:12 UTC

Comment 4 Christian Horn 2017-09-07 00:04:26 UTC
Description of problem:

Sometimes g-zip archives are not detected properly even though the magic code is the expected one (\037\213 at offset 0). In such case, "application/octet-stream" is detected instead.

It seems that this issue was present, then was fixed in Fedora (file 5.17), but base is more recent (see Additional info).


Version-Release number of selected component (if applicable):

file-5.11-33.el7.x86_64 


How reproducible:

Always with archive attached to the BZ


Steps to Reproduce:
1. file -i <archive>


Actual results:

application/octet-stream; charset=binary


Expected results:

application/x-gzip; charset=binary


Additional info:

[root@rhel7u2a opt]# for i in $(ls); do echo -ne "$i"; $i/bin/file -i /root/filename ; done
file-4.26/root/filename: application/x-gzip
file-5.00/root/filename: application/octet-stream; charset=binary
file-5.01/root/filename: application/octet-stream; charset=binary
file-5.02/root/filename: application/octet-stream; charset=binary
file-5.03/root/filename: application/octet-stream; charset=binary
file-5.04/root/filename: application/octet-stream; charset=binary
file-5.05/root/filename: application/octet-stream; charset=binary
file-5.06/root/filename: application/octet-stream; charset=binary
file-5.07/root/filename: application/octet-stream; charset=binary
file-5.08/root/filename: application/octet-stream; charset=binary
file-5.09/root/filename: application/octet-stream; charset=binary
file-5.10/root/filename: application/octet-stream; charset=binary
file-5.11/root/filename: application/octet-stream; charset=binary
file-5.12/root/filename: application/octet-stream; charset=binary
file-5.13/root/filename: application/octet-stream; charset=binary
file-5.14/root/filename: application/octet-stream; charset=binary
file-5.15/root/filename: application/octet-stream; charset=unknown
file-5.16/root/filename: binary; charset=binary
file-5.17/root/filename: application/x-gzip; charset=binary

-> fixed in 5.17

Workaround:

A workaround is to copy the g-zip code from source (magic/Magdir/compress, lines 23 to 51) to /etc/magic.

I don't understand why this actually works.

Comment 5 Kamil Dudka 2017-09-07 17:11:02 UTC
Thank you for reporting the bug!

This was fixed by the following upstream commit:

    https://github.com/file/file/commit/FILE5_16-6-g5c94551

... while only the following hunk is actually needed:

--- a/magic/Magdir/compress
+++ b/magic/Magdir/compress
@@ -22,6 +22,7 @@
 #         other than 8 ("deflate", the only method defined in RFC 1952).
 0       string          \037\213        gzip compressed data
 !:mime application/x-gzip
+!:strength * 2
 >2 byte    <8    \b, reserved method
 >2 byte    >8    \b, unknown method
 >3 byte    &0x01   \b, ASCII

Comment 14 errata-xmlrpc 2018-10-30 08:09:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3079


Note You need to log in before you can comment on or make changes to this bug.