[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: tests and update for issue #481 (#487) (b2236b96)
GitHub
noreply at github.com
Sun Jan 31 21:57:00 CET 2021
Repository : https://github.com/latex3/latex2e
On branch : develop
Link : https://github.com/latex3/latex2e/commit/b2236b96289d76821bc40be7d4a1b42fcf7c3e81
>---------------------------------------------------------------
commit b2236b96289d76821bc40be7d4a1b42fcf7c3e81
Author: David Carlisle <d.p.carlisle at gmail.com>
Date: Sun Jan 31 20:57:00 2021 +0000
tests and update for issue #481 (#487)
* tests and update for issue #481
* 1.0f not 1.0ef
* update rollback tests
* ltnews entry for issue #481
>---------------------------------------------------------------
b2236b96289d76821bc40be7d4a1b42fcf7c3e81
base/changes.txt | 5 ++++
base/doc/ltnews33.tex | 8 +++++-
base/ltfilehook.dtx | 30 +++++++++++++++++++---
base/testfiles/github-0481.lvt | 17 ++++++++++++
.../{github-0060.xetex.tlg => github-0481.tlg} | 2 ++
.../tlb-latexrelease-rollback-003-often.luatex.tlg | 2 ++
.../tlb-latexrelease-rollback-003-often.tlg | 2 ++
.../tlb-latexrelease-rollback-003-often.xetex.tlg | 2 ++
base/testfiles/tlb-rollback-004-often.luatex.tlg | 1 +
base/testfiles/tlb-rollback-004-often.tlg | 1 +
base/testfiles/tlb-rollback-004-often.xetex.tlg | 1 +
11 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 1259b9f6..0703995f 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,11 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
+2021-01-31 David Carlisle <David.Carlisle at latex-project.org>
+
+ * ltfilehook.dtx: set \protect to \string to avoid bad
+ expansion and possible non termination. github/481
+
2021-01-22 Marcel Krüger <Marcel.Krueger at latex-project.org>
* ltshipout.dtx:
diff --git a/base/doc/ltnews33.tex b/base/doc/ltnews33.tex
index 6929cb43..6c67592a 100644
--- a/base/doc/ltnews33.tex
+++ b/base/doc/ltnews33.tex
@@ -113,7 +113,6 @@
\section{Other changes to the \LaTeX{} kernel}
-
\subsection{\cs{end}\texttt{\textbraceleft document\textbraceright}
should always start in v-mode}
@@ -195,6 +194,13 @@ internal bookkeeping still takes place such as updating the
\texttt{shipout/lastpage} material if the page happens to be the first
or last.
+\subsection{Robust commands in filename arguments}
+The filename handling has been modified so that \verb|\string| is
+applied while normalising robust commands while detetermining the file
+name. Previously \verb|\input{\sqrt{2}}| would cause \LaTeX\ to loop indefinitely.
+With the new behaviour it accesses \verb|sqrt {2}.tex|.
+%
+\githubissue{481}
\subsection{\ldots}
diff --git a/base/ltfilehook.dtx b/base/ltfilehook.dtx
index 9f860458..ac35a3be 100644
--- a/base/ltfilehook.dtx
+++ b/base/ltfilehook.dtx
@@ -31,8 +31,8 @@
%%% From File: ltfilehook.dtx
%
% \begin{macrocode}
-\providecommand\ltfilehookversion{v1.0e}
-\providecommand\ltfilehookdate{2021/01/07}
+\providecommand\ltfilehookversion{v1.0f}
+\providecommand\ltfilehookdate{2021/01/31}
% \end{macrocode}
%
%<*driver>
@@ -999,6 +999,7 @@
% \subsection{Selecting a file (\cs{set at curr@file})}
%
% \begin{macro}{\set at curr@file,\@curr at file,\@curr at file@reqd}
+% \changes{v1.0f}{2021/01/31}{set \cs{protect} to \cs{string} gh/481}
% Now we hook into \cs{set at curr@file} to resolve a possible file
% substitution, and add \cs{@expl@@@filehook at set@curr at file@@nNN}
% at the end, after \cs{@curr at file} is set.
@@ -1022,11 +1023,12 @@
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>\IncludeInRelease{2021/05/01}%
%<latexrelease> {\set at curr@file}{Setting current file name}%
\def\set at curr@file#1{%
\begingroup
\escapechar\m at ne
+ \let\protect\string
\expandafter\def\csname\expandafter\endcsname
\expandafter{\csname\endcsname}%
% \end{macrocode}
@@ -1064,6 +1066,28 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>\def\set at curr@file#1{%
+%<latexrelease> \begingroup
+%<latexrelease> \escapechar\m at ne
+%<latexrelease> \expandafter\def\csname\expandafter\endcsname
+%<latexrelease> \expandafter{\csname\endcsname}%
+%<latexrelease> \@expl@@@filehook at if@no at extension@@nTF{#1}%
+%<latexrelease> {\@tempswatrue}{\@tempswafalse}%
+%<latexrelease> \@kernel at make@file at csname\@curr at file
+%<latexrelease> \@expl@@@filehook at resolve@file at subst@@w {#1}%
+%<latexrelease> \@expl@@@filehook at if@file at replaced@@TF
+%<latexrelease> {\@kernel at make@file at csname\@curr at file@reqd
+%<latexrelease> \@expl@@@filehook at normalize@file at name@@w{#1}%
+%<latexrelease> \if at tempswa \@expl@@@filehook at drop@extension@@N\@curr at file@reqd \fi}%
+%<latexrelease> {\if at tempswa \@expl@@@filehook at drop@extension@@N\@curr at file \fi
+%<latexrelease> \global\let\@curr at file@reqd\@curr at file}%
+%<latexrelease> \@expl@@@filehook at clear@replacement at flag@@
+%<latexrelease> \endgroup}
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+% \begin{macrocode}
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease> {\set at curr@file}{Setting current file name}%
%<latexrelease>\def\set at curr@file#1{%
diff --git a/base/testfiles/github-0481.lvt b/base/testfiles/github-0481.lvt
new file mode 100644
index 00000000..6ead169a
--- /dev/null
+++ b/base/testfiles/github-0481.lvt
@@ -0,0 +1,17 @@
+\documentclass{article}
+\input{test2e}
+\makeatletter
+\begin{document}
+
+\START
+% non termination before 2021
+% now sqrt {2}.tex
+\set at curr@file{\sqrt{2}}
+\typeout{\meaning\@curr at file}
+
+% filename protect{begingroup1endgroupover2}.tex before 2021
+% now frac {1}{2}.tex
+\set at curr@file{\frac{1}{2}}
+\typeout{\meaning\@curr at file}
+
+\END
diff --git a/base/testfiles/github-0060.xetex.tlg b/base/testfiles/github-0481.tlg
similarity index 72%
copy from base/testfiles/github-0060.xetex.tlg
copy to base/testfiles/github-0481.tlg
index 1d0c6975..b131cab6 100644
--- a/base/testfiles/github-0060.xetex.tlg
+++ b/base/testfiles/github-0481.tlg
@@ -1,2 +1,4 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
+macro:->sqrt {2}
+macro:->frac {1}{2}
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
index 0a81d6cf..19e88f06 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
@@ -404,6 +404,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
@@ -917,6 +918,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Already applied: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
index 3100d9d3..7647108d 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
@@ -398,6 +398,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
@@ -901,6 +902,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Already applied: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
index fd4391cf..bb5557e7 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
@@ -398,6 +398,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
@@ -910,6 +911,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Already applied: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.luatex.tlg b/base/testfiles/tlb-rollback-004-often.luatex.tlg
index f3d8a7ca..648b2733 100644
--- a/base/testfiles/tlb-rollback-004-often.luatex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.luatex.tlg
@@ -775,6 +775,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Already applied: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.tlg b/base/testfiles/tlb-rollback-004-often.tlg
index 452d5982..4426924d 100644
--- a/base/testfiles/tlb-rollback-004-often.tlg
+++ b/base/testfiles/tlb-rollback-004-often.tlg
@@ -763,6 +763,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Already applied: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.xetex.tlg b/base/testfiles/tlb-rollback-004-often.xetex.tlg
index 5eb7ad08..f015ca0c 100644
--- a/base/testfiles/tlb-rollback-004-often.xetex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.xetex.tlg
@@ -764,6 +764,7 @@ Skipping: [....-..-..] Declaring file substitution on input line ....
Skipping: [....-..-..] File substitution on input line ....
Applying: [....-..-..] File substitution on input line ....
Skipping: [....-..-..] Setting current file name on input line ....
+Skipping: [....-..-..] \set at curr@file on input line ....
Applying: [....-..-..] Setting current file name on input line ....
Already applied: [....-..-..] Setting current file name on input line ....
Skipping: [....-..-..] Make file csname on input line ....
More information about the latex3-commits
mailing list.