[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh577: Keep file path stack in sync when rolling back/forward (07750e06)
PhelypeOleinik
phelype.oleinik at latex-project.org
Thu Jun 3 21:46:12 CEST 2021
Repository : https://github.com/latex3/latex2e
On branch : hotfix/gh577
Link : https://github.com/latex3/latex2e/commit/07750e06612209e819181aa32520c9167783d445
>---------------------------------------------------------------
commit 07750e06612209e819181aa32520c9167783d445
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Thu Jun 3 16:46:12 2021 -0300
Keep file path stack in sync when rolling back/forward
Fixes #577
>---------------------------------------------------------------
07750e06612209e819181aa32520c9167783d445
base/changes.txt | 5 ++++
base/ltclass.dtx | 32 ++++++++++++++++++++--
base/testfiles/github-0577.lvt | 11 ++++++++
.../{github-0060.luatex.tlg => github-0577.tlg} | 3 ++
4 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 634eb0e3..ec21d4b5 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -10,6 +10,11 @@ are not part of the distribution.
All changes above are only part of the development branch for the next release.
================================================================================
+2021-06-03 Phelype Oleinik <phelype.oleinik at latex-project.org>
+
+ * ltclass.dtx:
+ Keep file path stack in sync when rolling back/forward (gh/577).
+
#########################
# 2020-06-01 Release
#########################
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index a0ab0fa3..bcb8f515 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltclass.dtx}
- [2021/05/18 v1.4b LaTeX Kernel (Class & Package Interface)]
+ [2021/06/03 v1.4c LaTeX Kernel (Class & Package Interface)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltclass.dtx}
@@ -757,14 +757,40 @@
% needed here to insert a \cs{@empty} to prevent the loss of braces.
% \changes{v1.3u}{2020/11/20}{Macro added}
% \changes{v1.3w}{2021/01/21}{Add empty entry for latexrelease}
+% \changes{v1.4c}{2021/06/03}%
+% {Take care of \cs{@kernel at currpathstack} when rolling
+% back/forward.}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}{\@kernel at currpathstack}%
%<latexrelease> {Add \@kernel at currpathstack}%
-\gdef\@kernel at currpathstack{}
-%<latexrelease>\g at addto@macro\@kernel at currpathstack{{}}
+% \end{macrocode}
+% If rolling backwards to this release, \cs{@kernel at currpathstack}
+% will be defined, so the \cs{gdef} line should not be executed, thus
+% the \cs{@gobblethree} will take it out, so the satck isn't touched.
+% \begin{macrocode}
+%<latexrelease>\@ifundefined{@kernel at currpathstack}{}{\@gobblethree}
+\gdef\@kernel at currpathstack{}%
+% \end{macrocode}
+% If rolling forward to this release, then the \cs{gdef} line above
+% will define the path stack to be empty (which it can't be, inside a
+% file), so the code below will traverse the \cs{@currnamestack}, and
+% add as many empty items to \cs{@kernel at currpathstack} as there are
+% items in \cs{@currnamestack}, so both are back in sync. Most of the
+% time \pkg{latexrelease} is loaded on top-level, so only one item is
+% needed, but \pkg{platexrelease} loads it internally, so the more
+% complicated loop is needed.
+% \begin{macrocode}
+%<latexrelease>\ifx\@kernel at currpathstack\@empty
+%<latexrelease> \def\reserved at a#1#2#3{%
+%<latexrelease> \ifx\relax#3\else
+%<latexrelease> \g at addto@macro\@kernel at currpathstack{{}}%
+%<latexrelease> \expandafter\reserved at a
+%<latexrelease> \fi}%
+%<latexrelease> \expandafter\reserved at a\@currnamestack{}{}{\relax}%
+%<latexrelease>\fi
\def\@p at pfilepath#1{%
\gdef\@currpath{#1}\@p at pfilepath@aux\@empty}
\def\@p at pfilepath@aux#1\@nil{%
diff --git a/base/testfiles/github-0577.lvt b/base/testfiles/github-0577.lvt
new file mode 100644
index 00000000..8db66971
--- /dev/null
+++ b/base/testfiles/github-0577.lvt
@@ -0,0 +1,11 @@
+\input{test2e}
+\begin{filecontents*}[overwrite]{\jobname.sty}
+\RequirePackageWithOptions{latexrelease}
+\START
+\@gobble\@nil
+\show\@kernel at currpathstack
+\OMIT
+\end{filecontents*}
+\RequirePackage[2020-10-01]{\jobname}
+\TIMO
+\END
diff --git a/base/testfiles/github-0060.luatex.tlg b/base/testfiles/github-0577.tlg
similarity index 57%
copy from base/testfiles/github-0060.luatex.tlg
copy to base/testfiles/github-0577.tlg
index 1d0c6975..2502f73e 100644
--- a/base/testfiles/github-0060.luatex.tlg
+++ b/base/testfiles/github-0577.tlg
@@ -1,2 +1,5 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
+> \@kernel at currpathstack=macro:
+->{}.
+l. ...\show\@kernel at currpathstack
More information about the latex3-commits
mailing list.