Bug 676543

Summary: RFE: recognition of TeX and LaTeX files needs an improvement
Product: [Fedora] Fedora Reporter: Jan Kaluža <jkaluza>
Component: fileAssignee: Jan Kaluža <jkaluza>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jkaluza, mmalik
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: file-5.04-7.fc13 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 675691 Environment:
Last Closed: 2011-02-21 07:26:06 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:
Bug Depends On: 675691, 826898    
Bug Blocks:    

Description Jan Kaluža 2011-02-10 07:38:38 UTC
+++ This bug was initially created as a clone of Bug #675691 +++

Description of problem:


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

How reproducible:
always

Steps to Reproduce:
# rpm -ql PyXML | grep -F .tex | xargs file
/usr/share/doc/PyXML-0.8.4/xml-howto.tex: Python script text executable
/usr/share/doc/PyXML-0.8.4/xml-ref.tex:   Python script text executable
# rpm -ql emacs-common | grep -F .tex | xargs file
/usr/share/emacs/23.1/etc/refcards/calccard.tex:      ASCII English text
/usr/share/emacs/23.1/etc/refcards/cs-dired-ref.tex:  ISO-8859 English text
/usr/share/emacs/23.1/etc/refcards/cs-refcard.tex:    TeX document text
/usr/share/emacs/23.1/etc/refcards/cs-survival.tex:   LaTeX document text
/usr/share/emacs/23.1/etc/refcards/de-refcard.tex:    TeX document text
/usr/share/emacs/23.1/etc/refcards/dired-ref.tex:     ASCII English text
/usr/share/emacs/23.1/etc/refcards/fr-dired-ref.tex:  ISO-8859 English text
/usr/share/emacs/23.1/etc/refcards/fr-refcard.tex:    TeX document text
/usr/share/emacs/23.1/etc/refcards/fr-survival.tex:   LaTeX document text
/usr/share/emacs/23.1/etc/refcards/gnus-refcard.tex:  LaTeX 2e document text
/usr/share/emacs/23.1/etc/refcards/orgcard.tex:       ASCII English text
/usr/share/emacs/23.1/etc/refcards/pl-refcard.tex:    ASCII English text
/usr/share/emacs/23.1/etc/refcards/pt-br-refcard.tex: ASCII English text
/usr/share/emacs/23.1/etc/refcards/refcard.tex:       ASCII English text
/usr/share/emacs/23.1/etc/refcards/ru-refcard.tex:    LaTeX 2e document text
/usr/share/emacs/23.1/etc/refcards/sk-dired-ref.tex:  ISO-8859 English text
/usr/share/emacs/23.1/etc/refcards/sk-refcard.tex:    TeX document text
/usr/share/emacs/23.1/etc/refcards/sk-survival.tex:   LaTeX document text
/usr/share/emacs/23.1/etc/refcards/survival.tex:      LaTeX document text
/usr/share/emacs/23.1/etc/refcards/vipcard.tex:       TeX document text
/usr/share/emacs/23.1/etc/refcards/viperCard.tex:     TeX document text
# 

Actual results:


Expected results:

--- Additional comment from jkaluza on 2011-02-07 09:05:15 EST ---

There are 2 problems:
1. File patterns for LaTeX check only first 400 bytes of file to determine its type and some of those files have long comment in the beginning,  I will increase that limit.

2. Patterns which match Python script are tried before Latex which is bad in case there's python code in latex.

I'll send patch to upstream mailing list and then attach it here.

--- Additional comment from jkaluza on 2011-02-08 04:19:45 EST ---

Created attachment 477581 [details]
proposed patch

Check 4096 bytes from TeX file instead of 400 bytes. Increate strength of TeX patterns to beat Python, because it's more usual to have Python in LaTeX than LaTeX in Python.

Comment 1 Fedora Update System 2011-02-10 09:34:50 UTC
file-5.04-7.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/file-5.04-7.fc13

Comment 2 Fedora Update System 2011-02-10 09:36:21 UTC
file-5.04-16.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/file-5.04-16.fc14

Comment 3 Fedora Update System 2011-02-10 21:27:49 UTC
file-5.04-7.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update file'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/file-5.04-7.fc13

Comment 4 Fedora Update System 2011-02-21 07:25:55 UTC
file-5.04-16.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 5 Fedora Update System 2011-04-17 21:23:32 UTC
file-5.04-7.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.