Skip to content

Commit

Permalink
further guarding of options for #932
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcarlisle committed Oct 22, 2022
1 parent 9bce4ab commit 3f67482
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 8 deletions.
4 changes: 4 additions & 0 deletions base/changes.txt
Expand Up @@ -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@latex-project.org>

* ltclass.dtx, ltdefns.dtx: Further \protect guards for gh/932

2022-10-22 Joseph Wright <Joseph.Wright@latex-project.org>

* ltkeys.dtx: Correct handling of unknown option list
Expand Down
17 changes: 11 additions & 6 deletions base/ltclass.dtx
Expand Up @@ -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}
Expand Down Expand Up @@ -1303,7 +1303,7 @@
\reserved@a\reserved@b
\@expl@@@filehook@clear@replacement@flag@@
% \end{macrocode}
% \changes{v1.5d}{2022/010/10}{Use \cs{protected@xdef}.}
% \changes{v1.5d}{2022/10/10}{Use \cs{protected@xdef}.}
% \begin{macrocode}
\expandafter\protected@xdef\csname opt@\reserved@a\endcsname{%
\@ifundefined{opt@\reserved@a}\@empty
Expand Down Expand Up @@ -1479,7 +1479,7 @@
% {Star form added.}
% \changes{v0.2c}{1993/11/17}
% {restoring \cs{@fileswith@pti@ns} added.}
% \changes{v1.5d}{2022/010/10}
% \changes{v1.5d}{2022/10/10}
% {Use \cs{protected@edef}.}
% \begin{macrocode}
\def\ProcessOptions{%
Expand Down Expand Up @@ -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}%
Expand All @@ -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@ption
\expandafter\let\csname ds@\CurrentOption\endcsname\@empty
Expand Down Expand Up @@ -1557,13 +1559,15 @@
% \end{macrocode}
%
% The common part of |\ProcessOptions| and |\ProcessOptions*|.
% \changes{v1.5e}{2022/10/22}{Use \cs{detokenize}}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\@process@pti@ns}{Unused options issue}%
\def\@process@pti@ns{%
\@for\CurrentOption:=\@curroptions\do{%
\edef\CurrentOption{\detokenize\expandafter{\CurrentOption}}%
\@ifundefined{ds@\CurrentOption}%
{\@use@ption
\default@ds}%
Expand Down Expand Up @@ -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@xdef}.}
% \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2020/10/01}%
Expand All @@ -2001,7 +2006,7 @@
\def\@fileswith@pti@ns#1[#2]#3[#4]{%
\ifx#1\@clsextension
\ifx\@classoptionslist\relax
\xdef\@classoptionslist{\zap@space#2 \@empty}%
\protected@xdef\@classoptionslist{\zap@space#2 \@empty}%
% \end{macrocode}
% Save raw class list.
% \begin{macrocode}
Expand Down Expand Up @@ -2192,7 +2197,7 @@
{\@onefilewithoptions@clashchk{#2}}
{%
% \end{macrocode}
% \changes{v1.5d}{2022/010/10}{Use \cs{protected@edef}.}
% \changes{v1.5d}{2022/10/10}{Use \cs{protected@edef}.}
% \begin{macrocode}
\expandafter\protected@edef\csname opt@\@currname.\@currext\endcsname
{\zap@space#2 \@empty}%
Expand Down Expand Up @@ -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@edef}.}
% \changes{v1.5d}{2022/10/10}{Use \cs{protected@edef}.}
% \begin{macrocode}
\def\@@unprocessedoptions{%
\ifx\@currext\@pkgextension
Expand Down
16 changes: 14 additions & 2 deletions base/ltdefns.dtx
Expand Up @@ -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}
Expand Down Expand Up @@ -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@edef}.}
% \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2022/11/01}%
%<latexrelease> {\@expandtwoargs}{protected edef}%
%<*2ekernel|latexrelease>
\def\@expandtwoargs#1#2#3{%
\edef\reserved@a{\noexpand#1{#2}{#3}}\reserved@a}
\protected@edef\reserved@a{\noexpand#1{#2}{#3}}\reserved@a}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{00/00/00}%
%<latexrelease>\def\@expandtwoargs#1#2#3{%
%<latexrelease>\edef\reserved@a{\noexpand#1{#2}{#3}}\reserved@a}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
Expand Down
8 changes: 8 additions & 0 deletions 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
25 changes: 25 additions & 0 deletions base/testfiles/github-0932b.tlg
@@ -0,0 +1,25 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
(article.cls
Document Class: article ....-..-.. v... Standard LaTeX document class
(size10.clo
File: size10.clo ....-..-.. v... Standard LaTeX file (size option)
)
\c@part=\count...
\c@section=\count...
\c@subsection=\count...
\c@subsubsection=\count...
\c@paragraph=\count...
\c@subparagraph=\count...
\c@figure=\count...
\c@table=\count...
\abovecaptionskip=\skip...
\belowcaptionskip=\skip...
\bibindent=\dimen...
) (fontenc.sty
Package: fontenc ....-..-.. v... Standard LaTeX package
) (inputenc.sty
Package: inputenc ....-..-.. v... Input encoding file
\inpenc@prehook=\toks...
\inpenc@posthook=\toks...
)

0 comments on commit 3f67482

Please sign in to comment.