Bug 594083

Summary: file cannot recognize a python script
Product: Red Hat Enterprise Linux 6 Reporter: Milos Malik <mmalik>
Component: fileAssignee: Jan Kaluža <jkaluza>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: ovasik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: file-5.04-6.el6 Doc Type: Bug Fix
Doc Text:
Prior to this update, the file utility could be unable to recognize Python scripts correctly. This update improves the file type recognition, and Python scripts are now identified as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-09 12:30:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
file patch
none
updated python, diff magic file none

Description Milos Malik 2010-05-20 14:21:17 UTC
Description of problem:


Version-Release number of selected component (if applicable):
file-5.04-4.el6.i686

How reproducible:
always

Steps to Reproduce:
# rpm -qf /usr/share/doc/python-magic-5.04/example.py
python-magic-5.04-4.el6.i686
# file /usr/share/doc/python-magic-5.04/example.py
/usr/share/doc/python-magic-5.04/example.py: ASCII Java program text
  
Actual results:
ASCII Java program text

Expected results:
python script or something similar

Comment 1 RHEL Program Management 2010-05-20 14:36:55 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 2 Milos Malik 2010-05-21 06:49:49 UTC
The same issue but another package:

# rpm -q file
file-5.04-4.el6.i686
# rpm -q setroubleshoot-plugins
setroubleshoot-plugins-2.1.51-1.el6.noarch
# rpm -ql setroubleshoot-plugins | grep '\.py$' | xargs file
/usr/share/setroubleshoot/plugins/__init__.py:                             ASCII text
/usr/share/setroubleshoot/plugins/allow_cvs_read_shadow.py:                HTML document text
/usr/share/setroubleshoot/plugins/allow_daemons_dump_core.py:              ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_execheap.py:                       HTML document text
/usr/share/setroubleshoot/plugins/allow_execmod.py:                        HTML document text
/usr/share/setroubleshoot/plugins/allow_execstack.py:                      HTML document text
/usr/share/setroubleshoot/plugins/allow_ftpd_anon_write.py:                ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_ftpd_full_access.py:               ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_ftpd_use_cifs.py:                  HTML document text
/usr/share/setroubleshoot/plugins/allow_ftpd_use_nfs.py:                   ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_httpd_anon_write.py:               ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_httpd_sys_script_anon_write.py:    ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_java_execstack.py:                 HTML document text
/usr/share/setroubleshoot/plugins/allow_kerberos.py:                       ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_mount_anyfile.py:                  ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_mplayer_execstack.py:              HTML document text
/usr/share/setroubleshoot/plugins/allow_nfsd_anon_write.py:                ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_postfix_local_write_mail_spool.py: ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_rsync_anon_write.py:               ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_saslauthd_read_shadow.py:          ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_smbd_anon_write.py:                ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_ypbind.py:                         ASCII Pascal program text
/usr/share/setroubleshoot/plugins/allow_zebra_write_config.py:             ASCII Pascal program text
/usr/share/setroubleshoot/plugins/automount_exec_config.py:                ASCII Pascal program text
/usr/share/setroubleshoot/plugins/bind_ports.py:                           ASCII Pascal program text
/usr/share/setroubleshoot/plugins/catchall.py:                             HTML document text
/usr/share/setroubleshoot/plugins/catchall_boolean.py:                     ASCII Pascal program text
...

Comment 3 Milos Malik 2010-05-21 07:23:31 UTC
Another reproducer:

# rpm -q file
file-5.04-4.el6.i686
# rpm -q m2crypto
m2crypto-0.20.2-5.el6.i686
# rpm -ql m2crypto | grep \.py$ | xargs file | grep -v python | tr -s ' '
/usr/share/doc/m2crypto-0.20.2/demo/Zope/ZServer/HTTPS_Server.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/Zope/ZServer/__init__.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/Zope/z2s.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/asynchat.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/asyncore.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/auth_handler.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/counter.py: ASCII C++ program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/default_handler.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/filesys.py: ASCII C++ program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/ftp_server.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/http_date.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/logger.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/m_syslog.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/medusa_gif.py: ASCII English text, with very long lines
/usr/share/doc/m2crypto-0.20.2/demo/medusa/mime_type_table.py: ASCII text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/poison_handler.py: HTML document text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/producers.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/put_handler.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/redirecting_handler.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/status_handler.py: HTML document text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/virtual_handler.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa/xmlrpc_handler.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/counter.py: ASCII C++ program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/default_handler.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/filesys.py: ASCII C++ program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/ftp_server.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/http_date.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/logger.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/m_syslog.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/medusa_gif.py: ASCII English text, with very long lines
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/poison_handler.py: HTML document text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/producers.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/status_handler.py: HTML document text
/usr/share/doc/m2crypto-0.20.2/demo/medusa054/xmlrpc_handler.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/pkcs7/test.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/ssl/http_cli_20.py: ASCII Java program text
/usr/share/doc/m2crypto-0.20.2/demo/tinderbox/build_lib.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/tinderbox/killableprocess.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/tinderbox/winprocess.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/demo/x509/proxylib.py: ASCII English text
/usr/share/doc/m2crypto-0.20.2/tests/fips.py: ASCII text

Comment 7 Jan Kaluža 2010-10-07 09:02:09 UTC
Created attachment 452058 [details]
file patch

Adds "string/t" directive, so "string" can be used also for text-based formats like Python. This patch is already accepted by upstream.

Comment 8 Jan Kaluža 2010-10-07 09:04:36 UTC
Created attachment 452059 [details]
updated python, diff magic file

Adds new magic patterns for Python and unified diff, which improves Python recognition, but it will never be 100%.

Comment 14 Jaromir Hradilek 2011-01-30 01:17:48 UTC
    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:
Prior to this update, the file utility could be unable to recognize Python scripts correctly. This update improves the file type recognition, and Python scripts are now identified as expected.

Comment 15 errata-xmlrpc 2011-02-09 12:30:05 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0204.html