After upgrading glibc, I found that chktex was unable to follow the names of \input commands, because it misdetected the name between the {} delimiter pair. I tried to re-emerge chktex, but to no success. Reproducible: Always Steps to Reproduce: Run chktex on a file which contains an \input command. Actual Results: For the sample files main.tex: \documentclass{article} \input{part} and part.tex: \begin{document} A \dots B \end{document} the output of: $ chktex main.tex is: ChkTeX v1.6.4 - Copyright 1995-96 Jens T. Berger Thielemann. chktex: WARNING -- Unable to open the TeX file `patt'. Warning 27 in main.tex line 3: Could not execute LaTeX command. \input{part} ^^^^^^ No errors printed; One warning printed; No user suppressed warnings printed. Expected Results: The output should be: ChkTeX v1.6.4 - Copyright 1995-96 Jens T. Berger Thielemann. Warning 1 in part.tex line 2: Command terminated with space. A \dots B ^ No errors printed; One warning printed; No user suppressed warnings printed. On line 221 of file FindErrs.c in the chktex-1.6.4 sources, the following call is performed: strcpy(OrigDest, OrigDest + 1); According to the man page of strcpy(3), the src and dst strings should not overlap, so the results are undefined. When I emerged glibc to version 2.12.2, the bug actually occurred. I have replaced the call for an alternative: ShiftLeftOne(OrigDest); defined as static void ShiftLeftOne(char *Buf) { char *P; for (P = Buf + 1; *P; ++P) *(P - 1) = *P; *(P - 1) = '\0'; } I will now attach the patch file and the ebuild to fix it.
Created attachment 286819 [details, diff] Fix to the file FindErr.c, to replace an undefined call to strcpy See bug report for a description of the detected bug, and my proposal to fix it.
Created attachment 286821 [details, diff] Fix to the file FindErr.c, to replace an undefined call to strcpy My excuses! I attached the wrong patch format!
Created attachment 286823 [details, diff] Ebuild which includes the attached patch. After ebuild chktex-1.6.4-r1 merge The compiled chktex no longer shows the bug.
BTW, I also filed a bug report in the chktex project page: https://savannah.nongnu.org/bugs/index.php?34322
Created attachment 286825 [details, diff] Fix to the file FindErr.c, to replace an undefined call to strcpy The patched code I had previously attached could produce a segfault under certain conditions. This updated patch should fix it.
should be fixed in 1.7.3 then