← Back to team overview

touch-packages team mailing list archive

[Bug 1485217] Re: Magic for text/x-tex broken

 

ideally that would be sent upstream to
https://bugs.freedesktop.org/enter_bug.cgi?product=shared-mime-info

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to shared-mime-info in
Ubuntu.
https://bugs.launchpad.net/bugs/1485217

Title:
  Magic for text/x-tex broken

Status in shared-mime-info package in Ubuntu:
  Incomplete

Bug description:
  The magic for text/x-tex in Ubuntu 15.04 is broken as it assigns
  text/x-tex to any text file which contains the word "section",
  "chapter" or "documentclass" within the first 100 characters.

  This behavior is fixed if one adds backslashes to the appropriate
  match values in /usr/share/mime/packages/freedesktop.org.xml (.in)
  (see attached patch).

  Edit: You can reproduce this bug as follows.

  Is (output on Ubuntu 15.04):
  user@host:/tmp/mime$ dpkg -s shared-mime-info | grep "Version"
  Version: 1.3-1
  user@host:/tmp/mime$ sed '30568,30638!d' /usr/share/mime/packages/freedesktop.org.xml
    <mime-type type="text/x-tex">
      <comment>TeX document</comment>
      <comment xml:lang="ar">مستند TeX</comment>
      <comment xml:lang="be@latin">Dakument TeX</comment>
      <comment xml:lang="bg">Документ — TeX</comment>
      <comment xml:lang="ca">document TeX</comment>
      <comment xml:lang="cs">Dokument TeX</comment>
      <comment xml:lang="cy">Dogfen TeX </comment>
      <comment xml:lang="da">TeX-dokument</comment>
      <comment xml:lang="de">TeX-Dokument</comment>
      <comment xml:lang="el">έγγραφο TeX</comment>
      <comment xml:lang="en_GB">TeX document</comment>
      <comment xml:lang="eo">TeX-dokumento</comment>
      <comment xml:lang="es">documento TeX</comment>
      <comment xml:lang="eu">TeX dokumentua</comment>
      <comment xml:lang="fi">TeX-asiakirja</comment>
      <comment xml:lang="fo">TeX skjal</comment>
      <comment xml:lang="fr">document TeX</comment>
      <comment xml:lang="ga">cáipéis TeX</comment>
      <comment xml:lang="gl">documenton TeX</comment>
      <comment xml:lang="he">מסמך TeX</comment>
      <comment xml:lang="hr">TeX dokument</comment>
      <comment xml:lang="hu">TeX-dokumentum</comment>
      <comment xml:lang="id">Dokumen TeX</comment>
      <comment xml:lang="it">Documento TeX</comment>
      <comment xml:lang="ja">TeX ドキュメント</comment>
      <comment xml:lang="kk">TeX құжаты</comment>
      <comment xml:lang="ko">TeX 문서</comment>
      <comment xml:lang="lt">TeX dokumentas</comment>
      <comment xml:lang="lv">TeX dokuments</comment>
      <comment xml:lang="ms">Dokumen TeX</comment>
      <comment xml:lang="nb">TeX-dokument</comment>
      <comment xml:lang="nl">TeX-document</comment>
      <comment xml:lang="nn">TeX-dokument</comment>
      <comment xml:lang="pl">Dokument TeX</comment>
      <comment xml:lang="pt">documento TeX</comment>
      <comment xml:lang="pt_BR">Documento TeX</comment>
      <comment xml:lang="ro">Document TeX</comment>
      <comment xml:lang="ru">документ TeX</comment>
      <comment xml:lang="sk">Dokument TeX</comment>
      <comment xml:lang="sl">Dokument TeX</comment>
      <comment xml:lang="sq">Dokument TeX</comment>
      <comment xml:lang="sr">ТеХ документ</comment>
      <comment xml:lang="sv">TeX-dokument</comment>
      <comment xml:lang="tr">TeX belgesi</comment>
      <comment xml:lang="uk">документ TeX</comment>
      <comment xml:lang="vi">Tài liệu TeX</comment>
      <comment xml:lang="zh_CN">TeX 文档</comment>
      <comment xml:lang="zh_TW">TeX 文件</comment>
      <sub-class-of type="text/plain"/>
      <alias type="application/x-tex"/>
      <glob pattern="*.tex"/>
      <glob pattern="*.ltx"/>
      <glob pattern="*.sty"/>
      <glob pattern="*.cls"/>
      <glob pattern="*.dtx"/>
      <glob pattern="*.ins"/>
      <glob pattern="*.latex"/>
      <magic priority="10">
        <match value="%" type="string" offset="0"/>
      </magic>
      <magic priority="50">
        <match value="\documentclass" type="string" offset="0:100"/>
      </magic>
      <magic priority="50">
        <match value="\chapter" type="string" offset="0:100"/>
      </magic>
      <magic priority="50">
        <match value="\section" type="string" offset="0:100"/>
      </magic>
    </mime-type>
  user@host:/tmp/mime$ echo "Normal text using 'sectional'." > no_tex
  user@host:/tmp/mime$ mimetype no_tex
  no_tex: text/x-tex
  user@host:/tmp/mime$ echo "\section{A \TeX Section}" > tex_file.tex
  user@host:/tmp/mime$ mimetype tex_file.tex
  tex_file.tex: text/x-tex

  
  Should (is, after patching):
  user@host:/tmp/mime$ sed '30568,30638!d' /usr/share/mime/packages/freedesktop.org.xml
    <mime-type type="text/x-tex">
      <comment>TeX document</comment>
      <comment xml:lang="ar">مستند TeX</comment>
      <comment xml:lang="be@latin">Dakument TeX</comment>
      <comment xml:lang="bg">Документ — TeX</comment>
      <comment xml:lang="ca">document TeX</comment>
      <comment xml:lang="cs">Dokument TeX</comment>
      <comment xml:lang="cy">Dogfen TeX </comment>
      <comment xml:lang="da">TeX-dokument</comment>
      <comment xml:lang="de">TeX-Dokument</comment>
      <comment xml:lang="el">έγγραφο TeX</comment>
      <comment xml:lang="en_GB">TeX document</comment>
      <comment xml:lang="eo">TeX-dokumento</comment>
      <comment xml:lang="es">documento TeX</comment>
      <comment xml:lang="eu">TeX dokumentua</comment>
      <comment xml:lang="fi">TeX-asiakirja</comment>
      <comment xml:lang="fo">TeX skjal</comment>
      <comment xml:lang="fr">document TeX</comment>
      <comment xml:lang="ga">cáipéis TeX</comment>
      <comment xml:lang="gl">documenton TeX</comment>
      <comment xml:lang="he">מסמך TeX</comment>
      <comment xml:lang="hr">TeX dokument</comment>
      <comment xml:lang="hu">TeX-dokumentum</comment>
      <comment xml:lang="id">Dokumen TeX</comment>
      <comment xml:lang="it">Documento TeX</comment>
      <comment xml:lang="ja">TeX ドキュメント</comment>
      <comment xml:lang="kk">TeX құжаты</comment>
      <comment xml:lang="ko">TeX 문서</comment>
      <comment xml:lang="lt">TeX dokumentas</comment>
      <comment xml:lang="lv">TeX dokuments</comment>
      <comment xml:lang="ms">Dokumen TeX</comment>
      <comment xml:lang="nb">TeX-dokument</comment>
      <comment xml:lang="nl">TeX-document</comment>
      <comment xml:lang="nn">TeX-dokument</comment>
      <comment xml:lang="pl">Dokument TeX</comment>
      <comment xml:lang="pt">documento TeX</comment>
      <comment xml:lang="pt_BR">Documento TeX</comment>
      <comment xml:lang="ro">Document TeX</comment>
      <comment xml:lang="ru">документ TeX</comment>
      <comment xml:lang="sk">Dokument TeX</comment>
      <comment xml:lang="sl">Dokument TeX</comment>
      <comment xml:lang="sq">Dokument TeX</comment>
      <comment xml:lang="sr">ТеХ документ</comment>
      <comment xml:lang="sv">TeX-dokument</comment>
      <comment xml:lang="tr">TeX belgesi</comment>
      <comment xml:lang="uk">документ TeX</comment>
      <comment xml:lang="vi">Tài liệu TeX</comment>
      <comment xml:lang="zh_CN">TeX 文档</comment>
      <comment xml:lang="zh_TW">TeX 文件</comment>
      <sub-class-of type="text/plain"/>
      <alias type="application/x-tex"/>
      <glob pattern="*.tex"/>
      <glob pattern="*.ltx"/>
      <glob pattern="*.sty"/>
      <glob pattern="*.cls"/>
      <glob pattern="*.dtx"/>
      <glob pattern="*.ins"/>
      <glob pattern="*.latex"/>
      <magic priority="10">
        <match value="%" type="string" offset="0"/>
      </magic>
      <magic priority="50">
        <match value="\\documentclass" type="string" offset="0:100"/>
      </magic>
      <magic priority="50">
        <match value="\\chapter" type="string" offset="0:100"/>
      </magic>
      <magic priority="50">
        <match value="\\section" type="string" offset="0:100"/>
      </magic>
    </mime-type>
  user@host:/tmp/mime$ echo "Normal text using 'sectional'." > no_tex
  user@host:/tmp/mime$ mimetype no_tex
  no_tex: text/plain
  user@host:/tmp/mime$ echo "\section{A \TeX Section}" > tex_file.tex
  user@host:/tmp/mime$ mimetype tex_file.tex
  tex_file.tex: text/x-tex

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/shared-mime-info/+bug/1485217/+subscriptions


References