-
-
Notifications
You must be signed in to change notification settings - Fork 303
Description
Brief outline of the bug
In @onefilewithoptions you have
\expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
before testing, whether or not the file has already been loaded. If it has not already been loaded you undefine it using
\expandafter\let\csname\@currname.\@currext-h@@k\endcsname
\@undefined
after
\csname\@currname.\@currext-h@@k\endcsname
But if the file already has been loaded, you do not undefine it. So before and after first time of loading a package \package.sty-h@@k is undefined. But after trying to load an already loaded package \package.sty-h@@k` is defined (and empty).
With the example file below, I would expect the \typeout output:
Before loading inputenc the after loading one file with options hook is undefin
ed as expected.
After loading inputenc the after loading one file with options hook is undefine
d as expected.
After second try to load inputenc the after loading one file with options hook
is undefined as expected.
but I get:
Before loading inputenc the after loading one file with options hook is undefin
ed as expected.
After loading inputenc the after loading one file with options hook is undefine
d as expected.
After second try to load inputenc the after loading one file with options hook
is unexpectedly defined.
IMHO it would be more clean to move the initialization of \csname\@currname.\@currext-h@@ok\endcsname just before the \InputIfFileExists. Moving the deinitialization behind the third argument of \@ifl@aded (before \@ifl@ter or at least before \@popfilename) or copying it also into the first argument of \@ifl@aded would not work (because sometimes a package foo requires a package bar, that requires package foo again and the inner already loaded case of foo should not reset \foo.sty-h@@k of the outer loading of foo).
Minimal example showing the bug
\RequirePackage{latexbug}
\documentclass{article}
\typeout{Before loading inputenc the after loading one file with options hook is
\ifcsname inputenc.sty-h@@k\endcsname unexpectedly defined.
\else undefined as expected.\fi}
\usepackage{inputenc}
\typeout{After loading inputenc the after loading one file with options hook is
\ifcsname inputenc.sty-h@@k\endcsname unexpectedly defined.
\else undefined as expected.\fi}
\usepackage{inputenc}
\typeout{After second try to load inputenc the after loading one file with options hook is
\ifcsname inputenc.sty-h@@k\endcsname unexpectedly defined.
\else undefined as expected.\fi}
\begin{document}
See the information written to the terminal and the log file.
\end{document}Log file (required) and possibly PDF file
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex 2019.10.6) 15 OCT 2019 11:11
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**hookdefined.tex
(./hookdefined.tex
LaTeX2e <2019-10-01>
(/usr/local/texlive/2019/texmf-dist/tex/latex/latexbug/latexbug.sty
Package: latexbug 2019/09/13 v1.0f Bug-classification
)
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/08/27 v1.4j Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2019/08/27 v1.4j Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
Before loading inputenc the after loading one file with options hook is undefin
ed as expected.
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2018/08/11 v1.3c Input encoding file
\inpenc@prehook=\toks14
\inpenc@posthook=\toks15
)
After loading inputenc the after loading one file with options hook is undefine
d as expected.
After second try to load inputenc the after loading one file with options hook
is unexpectedly defined.
(./hookdefined.aux)
\openout1 = `hookdefined.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
[1
{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./hook
defined.aux) )
Here is how much of TeX's memory you used:
734 strings out of 492166
12817 string characters out of 6125362
68201 words of memory out of 5000000
5176 multiletter control sequences out of 15000+600000
3640 words of font info for 14 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
25i,4n,19p,210b,487s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/c
m/cmr10.pfb>
Output written on hookdefined.pdf (1 page, 14093 bytes).
PDF statistics:
12 PDF objects out of 1000 (max. 8388607)
7 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
Metadata
Metadata
Assignees
Type
Projects
Status