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 1424989 - file command misinterprets text as python excuteable code
Summary: file command misinterprets text as python excuteable code
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: file
Version: 7.3
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: 1420851
TreeView+ depends on / blocked
 
Reported: 2017-02-20 09:30 UTC by Yogita
Modified: 2017-07-24 11:26 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-24 11:26:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 772651 0 unspecified CLOSED /usr/lib64/perl5/vendor_perl/Encode/Makefile_PL.e2x detected as C source wrongly 2021-02-22 00:41:40 UTC

Internal Links: 772651

Description Yogita 2017-02-20 09:30:56 UTC
Description of problem:
The file program misinterprets some text files as python scripts.

Version-Release number of selected component (if applicable):
file-5.11-31.el7.x86_64

How reproducible:
The bug can be reproduced using any file editor as follow -

Steps to Reproduce:
Create a file , eg- new.txt using any edit with 3 double quotes -

# cat new.txt
"""

Now test the type of file using "file" command -

# file new.txt

Actual results:
new.txt: Python script, ASCII text executable

Expected results:
new.txt: ASCII text

Additional info:

Comment 2 Kamil Dudka 2017-02-20 13:30:18 UTC
(In reply to Yogita from comment #0)
> # cat new.txt
> """

For files beginning with """, such a classification is expected.  This is the corresponding magic entry from latest upstream:

    # often the module starts with a multiline string
    0   string/t    """ Python script text executable

Luckily, files starting with """ is not what the customer complained about.

I tried the original reproducer and, in that case, the result seems incorrect, or at least less correct than the result of upstream file(1).  The difference is caused by file-5.10-strength.patch, which was introduced to fix bug #772651.

I propose to remove the patch from Fedora, which will fix this bug in RHEL-8 eventually.  On the other hand, I am afraid that changing the behavior of file(1) in a minor update of RHEL-7 could be disruptive for other customers.

Comment 3 Kamil Dudka 2017-02-23 15:25:37 UTC
fixed in file-5.30-4.fc26

Comment 4 Kamil Dudka 2017-07-24 11:26:44 UTC
Changing the behavior of the file command in a minor update of RHEL could break systems that rely on the current behavior.  The fix for this bug is included in Fedora 26 and it is going to be included in the next major release of RHEL.


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