[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh408-firstaid: fix for #408 initially only in firstaid (354295ee)

Frank Mittelbach frank.mittelbach at latex-project.org
Tue Oct 13 21:25:09 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/gh408-firstaid
Link       : https://github.com/latex3/latex2e/commit/354295ee4e2c9e75863b973872b0f543c8588d74

>---------------------------------------------------------------

commit 354295ee4e2c9e75863b973872b0f543c8588d74
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Tue Oct 13 21:25:09 2020 +0200

    fix for #408 initially only in firstaid


>---------------------------------------------------------------

354295ee4e2c9e75863b973872b0f543c8588d74
 base/testfiles/github-0408.lvt                     |  54 ++++++++
 base/testfiles/github-0408.tlg                     |  33 +++++
 required/firstaid/firstaid.ins                     |   6 +-
 .../latex2e-first-aid-for-external-files.dtx       | 143 +++++++++++++++++----
 4 files changed, 207 insertions(+), 29 deletions(-)

diff --git a/base/testfiles/github-0408.lvt b/base/testfiles/github-0408.lvt
new file mode 100644
index 00000000..a0495942
--- /dev/null
+++ b/base/testfiles/github-0408.lvt
@@ -0,0 +1,54 @@
+\RequirePackage{expl3} % force backend loading
+\ExplSyntaxOn
+\makeatletter
+\str_gremove_once:Nn \@filelist { ,l3backend-dvips.def }
+\str_gremove_once:Nn \@filelist { ,l3backend-xetex.def }
+\ExplSyntaxOff
+
+\begin{filecontents}[overwrite]{package-test-first.sty}
+\ProvidesPackage{package-test-first}[2020/10/11 11111]
+\newcommand\something{}
+\end{filecontents}
+
+\begin{filecontents}[overwrite]{package-test-before.sty}
+\ProvidesPackage{package-test-before}[2020/10/11 aaaaa]
+\RequirePackage{package-test-nest}
+\end{filecontents}
+
+\begin{filecontents}[overwrite]{package-test-after.sty}
+\ProvidesPackage{package-test-after}[2020/10/11 zzzzz]
+\end{filecontents}
+
+\begin{filecontents}[overwrite]{package-test-nest.sty}
+\ProvidesPackage{package-test-nest}[2020/10/11 {{{}}}]
+\end{filecontents}
+
+\begin{filecontents}[overwrite]{package-test.sty}
+\RequirePackage{package-test-first}
+\typeout{[1]> \@currpkg at reqd}
+\RequirePackage{package-test-before}
+\typeout{[2]> \@currpkg at reqd}
+\typeout{\csname ver at package-test-before.sty\endcsname}
+\ProvidesPackage{package-test}[2020/10/11 main package]
+\typeout{[3]> \@currpkg at reqd}
+\typeout{\csname ver at package-test-before.sty\endcsname}
+\RequirePackage{package-test-after}
+\typeout{[4]> \@currpkg at reqd}
+\end{filecontents}
+
+\documentclass{article}
+
+\input{test2e}
+
+\START
+\AddToHook{package/before/package-test}%
+  {\RequirePackage{package-test-first}}
+\usepackage{package-test}
+
+\listfiles
+
+\OMIT
+\begin{document}
+\TIMO
+
+\end{document}
diff --git a/base/testfiles/github-0408.tlg b/base/testfiles/github-0408.tlg
new file mode 100644
index 00000000..64d2a458
--- /dev/null
+++ b/base/testfiles/github-0408.tlg
@@ -0,0 +1,33 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+(package-test-first.sty
+Package: package-test-first ....-..-.. 11111
+) (package-test.sty
+[1]> package-test.sty
+(package-test-before.sty
+Package: package-test-before ....-..-.. aaaaa
+) (package-test-nest.sty
+Package: package-test-nest ....-..-.. {{{}}}
+)
+[2]> package-test.sty
+2020/10/11 aaaaa
+Package: package-test ....-..-.. main package
+[3]> package-test.sty
+2020/10/11 aaaaa
+(package-test-after.sty
+Package: package-test-after ....-..-.. zzzzz
+)
+[4]> package-test.sty
+)
+(github-0408.aux)
+ *File List*
+   expl3.sty    ....-..-.. L3 programming layer (loader) 
+ article.cls    ....-..-.. v... Standard LaTeX document class
+  size10.clo    ....-..-.. v... Standard LaTeX file (size option)
+  test2e.tex
+package-test-first.sty    ....-..-.. 11111
+package-test.sty    ....-..-.. main package
+package-test-before.sty    ....-..-.. aaaaa
+package-test-nest.sty    ....-..-.. {{{}}}
+package-test-after.sty    ....-..-.. zzzzz
+ ***********
diff --git a/required/firstaid/firstaid.ins b/required/firstaid/firstaid.ins
index 5d888cf6..9965480f 100644
--- a/required/firstaid/firstaid.ins
+++ b/required/firstaid/firstaid.ins
@@ -3,7 +3,7 @@
 %% driver files from the doc files in this package when run through
 %% LaTeX or TeX.
 %%
-%% Copyright (C) 1993-2020
+%% Copyright (C) 2020
 %% The LaTeX3 Project and any individual authors listed elsewhere
 %% in this file.
 %%
@@ -44,12 +44,12 @@ reports for it can be opened at https://latex-project.org/bugs/
 (but please observe conditions on bug reports sent to that address!)
 
 
-Copyright (C) 1993-2020
+Copyright (C) 2020
 The LaTeX3 Project and any individual authors listed elsewhere
 in this file.
 
 This file was generated from file(s) of the Standard LaTeX `First Aid Bundle'.
---------------------------------------------------------------------------
+------------------------------------------------------------------------------
 
 It may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c
diff --git a/required/firstaid/latex2e-first-aid-for-external-files.dtx b/required/firstaid/latex2e-first-aid-for-external-files.dtx
index 78f52ca7..8a0160a4 100644
--- a/required/firstaid/latex2e-first-aid-for-external-files.dtx
+++ b/required/firstaid/latex2e-first-aid-for-external-files.dtx
@@ -87,6 +87,17 @@
 %    doesn't get out of bounds.
 %    \end{quote}
 %
+%  \subsection{Minor kernel fixes}
+%
+%    If we encounter issues with the kernel code that should get fixed
+%    before the next main release we normally generate a patch release
+%    for \LaTeX{}.  However, depending on the complexity of the fix we
+%    might first add the fix here and generate a full patch release
+%    only when a number of such issues have accumulated. This way we
+%    lessen the impact on CTAN maintainers because for each tach
+%    release we have to make and distribute also a matching
+%    development release.
+%
 % \StopEventually{\setlength\IndexMin{200pt}  \PrintIndex  }
 %
 %
@@ -99,8 +110,8 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\def\LaTeXFirstAidDate{2020/10/04}
-\def\LaTeXFirstAidVersion{v1.0e}
+\def\LaTeXFirstAidDate{2020/10/13}
+\def\LaTeXFirstAidVersion{v1.0f}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -147,37 +158,28 @@
 %    implementation.
 %
 %    The package has now got an update so we aren't activating the
-%    first aid. However, it basically bypasses the new hook mechanism
-%    and puts the old hooks in thereby disabling, for example, the
-%    possibility to reorder code through rules.
+%    first aid. However, at the moment it basically bypasses the new
+%    hook mechanism and puts the old hooks in thereby disabling, for
+%    example, the possibility to re-order code through rules.
 %
 %    We therefore keep \texttt{filehook-ltx.sty} around as a guideline
 %    for further updates.
 %
+%    Replacing \pkg{filehook} with a leaner version would then work
+%    like this:
 %    \begin{macrocode}
 %<*kernel>
 %\declare at file@substitution{filehook.sty}{filehook-ltx.sty}
 %</kernel>
-%    \End{macrocode}
-%
-%    If a new filehook package becomes available it can be tested
-%    simply by  undoing the above substitution via
-%    \begin{verbatim}
-%  \undeclare at file@substitution{filehook.sty}
-%    \end{verbatim}
-%    Once ready this will then taken out of the first aid file.
+%    \end{macrocode}
 %
-%    What follows is a partial implementation of the  \pkg{filehook}
+%    What follows is a simplified (partial) implementation of the  \pkg{filehook}
 %    interfaces.
-%
 %    Not implemented are:
 %\begin{verbatim}
-%  \AtBeginOfFiles
-%  \AtEndOfFiles
-%  \AtBeginOfInputs
-%  \AtEndOfInputs
-%  \AtBeginOfInputFile
-%  \AtEndOfInputFile
+%  \AtBeginOfFiles      \AtEndOfFiles
+%  \AtBeginOfInputs     \AtEndOfInputs
+%  \AtBeginOfInputFile  \AtEndOfInputFile
 %\end{verbatim}
 %
 %    \begin{macrocode}
@@ -214,7 +216,6 @@
   {\AddToHook{class/after}{#1}}
 %    \end{macrocode}
 %
-%    For normal files we drop the \texttt{.tex} extension for now:
 %    \begin{macrocode}
 \newcommand\AtBeginOfFile [2]
   {\AddToHook{file/before/#1}{#2}}
@@ -222,6 +223,7 @@
   {\AddToHook{file/after/#1}{#2}}
 %    \end{macrocode}
 %
+%    Some commands offered a starred form  
 %    \begin{macrocode}
 \DeclareDocumentCommand \AtBeginOfPackageFile {smm}
    {\IfBooleanTF{#1}%
@@ -230,6 +232,9 @@
          {\AddToHook{package/before/#2}{#3}}}%
      {\AddToHook{package/before/#2}{#3}}%
    }
+%    \end{macrocode}
+%    
+%    \begin{macrocode}
 \DeclareDocumentCommand \AtEndOfPackageFile {smm}
    {\IfBooleanTF{#1}%
      {\@ifpackageloaded{#2}%
@@ -294,6 +299,10 @@
 %    is still in the kernel.
 %
 %    \begin{macrocode}
+%<*kernel>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \AddToHook{file/after/biditools.sty}[firstaid]{%
   \FirstAidNeededT{biditools}{sty}%
                   {2020/05/13 v2 Programming tools for bidi package}%
@@ -322,10 +331,6 @@
 }
 %    \end{macrocode}
 %    
-%    \begin{macrocode}
-%<*kernel>
-%    \end{macrocode}
-%
 %
 %
 % \subsection{The \pkg{dinbrief} class first aid}
@@ -341,6 +346,92 @@
 %
 %
 %
+% \subsection[Temporary fixes for the kernel (until the next
+%             patch-level release)]
+%    {Temporary fixes for the kernel \\
+%     (until the next patch-level release)}
+%
+%    This is fixing GitHub issue 408. Looks rather long but changes
+%    only 3 or 4 lines in the macros.
+%    \begin{macrocode}
+\def\@pr at videpackage[#1]{%
+  \expandafter\protected at xdef                %     <-- protected...
+     \csname ver@\@currname.\@currext\endcsname{#1}% Loaded package
+  \expandafter\let
+    \csname ver@\@currpkg at reqd\expandafter\endcsname % Requested package
+    \csname ver@\@currname.\@currext\endcsname
+  \ifx\@currext\@clsextension
+    \typeout{Document Class: \@gtempa\space#1}%
+  \else
+    \protected at wlog{Package: \@gtempa\space#1}%   <--- protected
+  \fi}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\def\@onefilewithoptions#1[#2][#3]#4{%
+  \@pushfilename
+  \xdef\@currname{#1}%
+  \global\let\@currext#4%
+  \@ifl at aded\@currext\@currname
+    {\@if at ptions\@currext{\@currname}{#2}{}%
+      {\@latex at error
+        {Option clash for \@cls at pkg\space \@currname}%
+        {The package \@currname\space has already been loaded
+         with options:\MessageBreak
+         \space\space[\@ptionlist{\@currname.\@currext}]\MessageBreak
+         There has now been an attempt to load it
+          with options\MessageBreak
+         \space\space[#2]\MessageBreak
+         Adding the global options:\MessageBreak
+         \space\space
+              \@ptionlist{\@currname.\@currext},#2\MessageBreak
+         to your \noexpand\documentclass declaration may fix this.%
+         \MessageBreak
+         Try typing \space <return> \space to proceed.}}%
+     \@firstofone}%
+    {\makeatletter
+     \@reset at ptions
+     \IfFileExists{\@currname.\@currext}{}%
+       {\@missing at onefilewithoptions{#2}}%
+     \ifx\@currname\@empty
+       \expandafter\@gobble
+     \else
+       \@disable at packageload@do{\@currname.\@currext}%
+         {\@expl@@@filehook at file@push@@
+          \set at curr@file{\@currname.\@currext}%
+          \@filehook at set@CurrentFile
+          \expandafter\@swaptwoargs\expandafter
+            {\expandafter{\@currpkg at reqd}}%
+            {% <
+          \edef\@currpkg at reqd{\@currname.\@currext}%
+          \ifx\CurrentFile\CurrentFileUsed
+          \else
+            \filename at parse\@curr at file
+            \edef\@currname{\string at makeletter\filename at base}%
+            \edef\@currext{\string at makeletter\filename at ext}%
+          \fi
+          \load at onefile@withoptions{#2}%
+          \def\@currpkg at reqd%{\@currpkg at reqd}
+            }% >
+          \@expl@@@filehook at file@pop@@}%
+       \expandafter\@firstofone
+     \fi}%
+    {\@ifl at ter\@currext{\@currname}{#3}{}%
+      {\@latex at warning@no at line
+        {You have requested,\on at line,
+         version\MessageBreak
+           `#3' of \@cls at pkg\space \@currname,\MessageBreak
+         but only version\MessageBreak
+          `\csname ver@\@currname.\@currext\endcsname'\MessageBreak
+         is available}}%
+     \ifx\@currext\@clsextension\let\LoadClass\@twoloadclasserror\fi}%
+    \@popfilename
+    \@reset at ptions}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\let\@currpkg at reqd\@empty
+%    \end{macrocode}
 %
 %
 %    \begin{macrocode}





More information about the latex3-commits mailing list.