Red Hat Bugzilla – Bug 641838
file(1) mis-handle gzip file as FLC file.
Last modified: 2012-10-29 08:56:55 EDT
+++ This bug was initially created as a clone of Bug #241848 +++ Description of problem: file(1) mis-handle gzip file as FLC file. Version-Release number of selected component (if applicable): # rpm -q file file-4.17-15.el5_3.1 How reproducible: Only corner cases in normal environment. 100% if your follow my steps. Steps to Reproduce: # touch abc # touch -m -t 200705080758.26 ./abc # gzip abc # file abc.gz abc.gz: FLC file - 17983 frames width=768 pixels, height=25185 pixels, depth=99, ticks/frame=0 Actual results: abc.gz: FLC file - 17983 frames width=768 pixels, height=25185 pixels, depth=99, ticks/frame=0 Expected results: # file abc.gz abc.gz: gzip compressed data, was "abc", from Unix Additional info: The file header looks like this. 00000000 1F 8B 08 08 12 AF 3F 46 00 03 65 65 65 65 65 65 ......?F..eeeeee file(1) see 12 AF part at first, then recognize the file as FLC, although other part of the header (1F 8B) include gzip style. 12 AF part of the gzip header is generated from "mtime" of the original file by gzip. My understanding is gzip works as it should be. But file(1) doesn't check the file header carefully. The issue can be easily reproduced using the files from the attachment 293705 [details]. Please note that the original RHEL-4 bug has been already closed with errata.
Created attachment 452665 [details] Proposed patch
I've tested the patch and it fixes the bug.
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.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Cause: In some situation, gzip files can have the same beginning as FLC files. File tries to match FLC magic patterns before gzip magic patterns. Consequence: This causes some gzip files are detected as FLC files. Fix: Order of gzip and FLC magic patterns have been changed, because gzip magic pattern is longer and therefore stronger. Result: File now tries to match gzip magic pattern before FLC magic pattern, so it detects gzip files properly.
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. http://rhn.redhat.com/errata/RHBA-2012-0201.html