[latex3-commits] [git/LaTeX3-latex3-latex2e] gh932b: further guarding of options for #932 (3f67482c)

David Carlisle d.p.carlisle at gmail.com
Sat Oct 22 13:59:25 CEST 2022


Repository : https://github.com/latex3/latex2e
On branch  : gh932b
Link       : https://github.com/latex3/latex2e/commit/3f67482cbe521dbb68c3fb54494f354583fc27de

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

commit 3f67482cbe521dbb68c3fb54494f354583fc27de
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sat Oct 22 12:59:25 2022 +0100

    further guarding of options for #932


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

3f67482cbe521dbb68c3fb54494f354583fc27de
 base/changes.txt                                      |  4 ++++
 base/ltclass.dtx                                      | 17 +++++++++++------
 base/ltdefns.dtx                                      | 16 ++++++++++++++--
 base/testfiles/github-0932b.lvt                       |  8 ++++++++
 base/testfiles/{github-0022c.tlg => github-0932b.tlg} |  8 ++++++--
 5 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index f3d7198f..3a626bbc 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,10 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2022-10-22  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* ltclass.dtx, ltdefns.dtx: Further \protect guards for gh/932
+
 2022-10-22  Joseph Wright  <Joseph.Wright at latex-project.org>
 
 	* ltkeys.dtx: Correct handling of unknown option list
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index 72dc9f98..7b1ca077 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2022/10/10 v1.5d LaTeX Kernel (Class & Package Interface)]
+             [2022/10/22 v1.5e LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -1303,7 +1303,7 @@
       \reserved at a\reserved at b
   \@expl@@@filehook at clear@replacement at flag@@
 %    \end{macrocode}
-% \changes{v1.5d}{2022/010/10}{Use \cs{protected at xdef}.}
+% \changes{v1.5d}{2022/10/10}{Use \cs{protected at xdef}.}
 %    \begin{macrocode}
   \expandafter\protected at xdef\csname opt@\reserved at a\endcsname{%
     \@ifundefined{opt@\reserved at a}\@empty
@@ -1479,7 +1479,7 @@
 %         {Star form added.}
 % \changes{v0.2c}{1993/11/17}
 %         {restoring \cs{@fileswith at pti@ns} added.}
-% \changes{v1.5d}{2022/010/10}
+% \changes{v1.5d}{2022/10/10}
 %         {Use \cs{protected at edef}.}
 %    \begin{macrocode}
 \def\ProcessOptions{%
@@ -1510,6 +1510,7 @@
 % \changes{v0.2y}{1994/02/07}
 %         {Add extra ,s so `two' is not matched with `twocolumn'}
 % \changes{v1.3z}{2021/03/05}{modify so braces to not give errors (gh/513)}
+% \changes{v1.5e}{2022/10/22}{Use \cs{detokenize}}
 %    \begin{macrocode}
 %</2ekernel>
 %<latexrelease>\IncludeInRelease{2021/06/01}%
@@ -1520,6 +1521,7 @@
    \ifx\@classoptionslist\relax\else
     \@for\CurrentOption:=\@classoptionslist\do{%
       \ifx\CurrentOption\@empty\else
+        \edef\CurrentOption{\detokenize\expandafter{\CurrentOption}}%
         \@ifundefined{ds@\CurrentOption}{}{%
           \@use at ption
           \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
@@ -1557,6 +1559,7 @@
 %    \end{macrocode}
 %
 % The common part of |\ProcessOptions| and |\ProcessOptions*|.
+% \changes{v1.5e}{2022/10/22}{Use \cs{detokenize}}
 %    \begin{macrocode}
 %</2ekernel>
 %<*2ekernel|latexrelease>
@@ -1564,6 +1567,7 @@
 %<latexrelease>                 {\@process at pti@ns}{Unused options issue}%
 \def\@process at pti@ns{%
   \@for\CurrentOption:=\@curroptions\do{%
+   \edef\CurrentOption{\detokenize\expandafter{\CurrentOption}}%
     \@ifundefined{ds@\CurrentOption}%
       {\@use at ption
        \default at ds}%
@@ -1993,6 +1997,7 @@
 % \changes{v2.1b}{2016/11/09}
 %         {Improve \cs{ifx} tests PR/4497}
 % \changes{v1.3x}{2021/02/18}{save raw class option list (gh/85)}
+% \changes{v1.5e}{2022/10/22}{Use \cs{protected at xdef}.}
 %    \begin{macrocode}
 %</2ekernel>
 %<latexrelease>\IncludeInRelease{2020/10/01}%
@@ -2001,7 +2006,7 @@
 \def\@fileswith at pti@ns#1[#2]#3[#4]{%
   \ifx#1\@clsextension
     \ifx\@classoptionslist\relax
-      \xdef\@classoptionslist{\zap at space#2 \@empty}%
+      \protected at xdef\@classoptionslist{\zap at space#2 \@empty}%
 %    \end{macrocode}
 % Save raw class list.
 %    \begin{macrocode}
@@ -2192,7 +2197,7 @@
         {\@onefilewithoptions at clashchk{#2}}
         {%
 %    \end{macrocode}
-% \changes{v1.5d}{2022/010/10}{Use \cs{protected at edef}.}
+% \changes{v1.5d}{2022/10/10}{Use \cs{protected at edef}.}
 %    \begin{macrocode}
           \expandafter\protected at edef\csname opt@\@currname.\@currext\endcsname
             {\zap at space#2 \@empty}%
@@ -2701,7 +2706,7 @@
 % \changes{v0.2v}{1994/01/29}
 %         {Macro added.}
 % \changes{v1.0t}{1995/11/14}{Allow empty option}
-% \changes{v1.5d}{2022/010/10}{Use \cs{protected at edef}.}
+% \changes{v1.5d}{2022/10/10}{Use \cs{protected at edef}.}
 %    \begin{macrocode}
 \def\@@unprocessedoptions{%
   \ifx\@currext\@pkgextension
diff --git a/base/ltdefns.dtx b/base/ltdefns.dtx
index 9e1fa43f..cbbd5edc 100644
--- a/base/ltdefns.dtx
+++ b/base/ltdefns.dtx
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltdefns.dtx}
-             [2022/05/13 v1.5q LaTeX Kernel (definition commands)]
+             [2022/05/22 v1.5r LaTeX Kernel (definition commands)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltdefns.dtx}
@@ -966,9 +966,21 @@
 %
 % \begin{macro}{\@expandtwoargs}
 %    A macro to totally expand two arguments to another macro
+% \changes{v1.5r}{2022/10/22}{Use \cs{protected at edef}.}
 %    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2022/11/01}%
+%<latexrelease>        {\@expandtwoargs}{protected edef}%
+%<*2ekernel|latexrelease>
 \def\@expandtwoargs#1#2#3{%
-\edef\reserved at a{\noexpand#1{#2}{#3}}\reserved at a}
+\protected at edef\reserved at a{\noexpand#1{#2}{#3}}\reserved at a}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{00/00/00}%
+%<latexrelease>\def\@expandtwoargs#1#2#3{%
+%<latexrelease>\edef\reserved at a{\noexpand#1{#2}{#3}}\reserved at a}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
 %    \end{macrocode}
 % \end{macro}
 %
diff --git a/base/testfiles/github-0932b.lvt b/base/testfiles/github-0932b.lvt
new file mode 100644
index 00000000..09bb6a9c
--- /dev/null
+++ b/base/testfiles/github-0932b.lvt
@@ -0,0 +1,8 @@
+\input{test2e}
+% there should be no error from \sqrt
+\START
+\documentclass[foo,bar,baz=foo,ggg=\sqrt{4}]{article}
+
+\usepackage{fontenc}% \ProcessOptions*
+\usepackage{inputenc}% \ProcessOptions
+\END
\ No newline at end of file
diff --git a/base/testfiles/github-0022c.tlg b/base/testfiles/github-0932b.tlg
similarity index 72%
copy from base/testfiles/github-0022c.tlg
copy to base/testfiles/github-0932b.tlg
index 9b992b46..33172943 100644
--- a/base/testfiles/github-0022c.tlg
+++ b/base/testfiles/github-0932b.tlg
@@ -16,6 +16,10 @@ File: size10.clo ....-..-.. v... Standard LaTeX file (size option)
 \abovecaptionskip=\skip...
 \belowcaptionskip=\skip...
 \bibindent=\dimen...
-) (github-0022c0.sty) (github-0022c1.sty
-*** FOO OPTION ***
+) (fontenc.sty
+Package: fontenc ....-..-.. v... Standard LaTeX package
+) (inputenc.sty
+Package: inputenc ....-..-.. v... Input encoding file
+\inpenc at prehook=\toks...
+\inpenc at posthook=\toks...
 )





More information about the latex3-commits mailing list.