# chktex not reading lines correctly

I'm trying to use chktex in Ubuntu but it seems to not be reading lines correctly. When I run it on a file that has this line (and any other line like it):

\include{glossary}


it send an error saying (note that it replaces the char before last in the file name with the last char! - glossayy)

chktex: WARNING -- Unable to open the TeX file glossayy'.
Warning 27 in book.tex line 158: Could not execute LaTeX command.
\include{glossary}        % Glossary
^^^^^^^^


Any ideas why this happens?

-
This looks like a problem with chktex rather than LaTeX. You're probably better off filing a bug report with the maintainer of chktex. –  Seamus Jan 21 '12 at 11:27

Using chktex v1.6.4 on Ubuntu 11.04 the spelling error was not reproduced (see below). Further, this version gave the warning only when it was valid. I suggest you try this again with this version.

If the problem still occurs a minimal working example would be helpful as would information as to whether the warning is just mis-spelled or also spurious (e.g. warning about files that exist).

Detail

Result from running on a small sample file that generates a warning but does not have a \include line:

mas@ents:~/LaTeX/scratch$chktex fr.tex ChkTeX v1.6.4 - Copyright 1995-96 Jens T. Berger Thielemann. Warning 36 in fr.tex line 5: You should put a space in front of parenthesis. \textit{(Choose one option)}\\ ^ No errors printed; One warning printed; No user suppressed warnings printed.  edited test file to remedy the warning, include a \include{glossary} line similar to the one in the question. glossary.tex does not exist . Re-ran chktex: mas@ents:~/LaTeX/scratch$ vi fr.tex
mas@ents:~/LaTeX/scratch$chktex fr.tex ChkTeX v1.6.4 - Copyright 1995-96 Jens T. Berger Thielemann. chktex: WARNING -- Unable to open the TeX file glossary'. Warning 27 in fr.tex line 10: Could not execute LaTeX command. \include{glossary} % Glossary ^^^^^^^^ No errors printed; One warning printed; No user suppressed warnings printed. mas@ents:~/LaTeX/scratch$


warning is correct and does not include the glossayy text error.

With glossary.tex created, chktex returns no warnings:

mas@ents:~/LaTeX/scratch$mv glossary.texxx glossary.tex mas@ents:~/LaTeX/scratch$ chktex fr.tex
ChkTeX v1.6.4 - Copyright 1995-96 Jens T. Berger Thielemann.

No errors printed; No warnings printed; No user suppressed warnings printed.
mas@ents:~/LaTeX/scratch\$

-

This was a problem with calling strcpy on overlapping strings. With some versions of glibc this caused problems and with others it didn't. This was fixed in the svn version to use memmove. I recently got svn access, so I'm hoping we can release a new version with this (and a few other bugs) fixed. Anyway, the bottom line is that if you build it yourself form svn then it will be fixed (version is 1.6.5svn).

-
I have released 1.6.6 which fixes this problem. Of course it may take a while for it to filter down to Ubuntu. –  Ivan Andrus Apr 20 '12 at 21:22