-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!(pgfkeys): more careful treatment of \relax in pgfkeys
There are a lot of instances in pgfkeys where \csname is used, e.g. in \pgfkeysgetvalueof. This will \let the mentioned csname become \relax so we have to be prepared for this in across the board in pgfkeys. Indeed, this was the original behavior before eTeX but it somehow got lost when transitioning to \ifcsname. The behavior is broken with eTeX since 641a883. BREAKING CHANGE: \pgfkeysvalueof will expand to an alias for the primitve \relax in case the key was undefined rather than to a \relaxed csname. Co-authored-by: Jonathan Spratte <jspratte@yahoo.de> Co-authored-by: muzimuzhi <muzimuzhi@gmail.com> Signed-off-by: Henri Menke <henri@henrimenke.de>
- Loading branch information
1 parent
4cba1da
commit 1dbf7ae
Showing
5 changed files
with
114 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
\documentclass{minimal} | ||
\input{pgf-regression-test} | ||
|
||
\RequirePackage{pgfkeys} | ||
|
||
\begin{document} | ||
|
||
\START | ||
|
||
\BEGINTEST{pgfkeys: prevent csname from implicitly defining /foo} | ||
\pgfkeysgetvalue{/foo}{\mycmd} | ||
\pgfkeysifdefined{/foo}{\TYPE{true}}{\TYPE{false}} | ||
\ENDTEST | ||
|
||
\BEGINTEST{pgfkeys: keys must be able to hold \relax} | ||
|
||
% essentially \let\csname pgfk@/bar\endcsname\relax | ||
\pgfkeyslet{/bar}{\relax} | ||
\pgfkeys{/bar} | ||
\pgfkeysifdefined{/bar}{\TYPE{true}}{\TYPE{false}} | ||
|
||
% essentially \def\csname pgfk@/bar\endcsname{\relax} | ||
\pgfkeys{/bar/.initial=\relax} | ||
\pgfkeys{/bar} | ||
\pgfkeysifdefined{/bar}{\TYPE{true}}{\TYPE{false}} | ||
|
||
\pgfkeyslet{/bar}{\undefined} | ||
\pgfkeysifdefined{/bar}{\TYPE{true}}{\TYPE{false}} | ||
\ENDTEST | ||
|
||
\BEGINTEST{pgfkeys: nice error handling for accidental \relax in /.@cmd} | ||
\csname pgfk@/baz/.@cmd\endcsname | ||
\pgfkeys{/baz} | ||
\ENDTEST | ||
|
||
\END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
This is a generated file for the l3build validation system. | ||
Don't change this file in any respect. | ||
============================================================ | ||
TEST 1: pgfkeys: prevent csname from implicitly defining /foo | ||
============================================================ | ||
false | ||
============================================================ | ||
============================================================ | ||
TEST 2: pgfkeys: keys must be able to hold \relax | ||
============================================================ | ||
true | ||
true | ||
false | ||
============================================================ | ||
============================================================ | ||
TEST 3: pgfkeys: nice error handling for accidental \relax in /.@cmd | ||
============================================================ | ||
! Package pgfkeys Error: I do not know the key '/baz' and I am going to ignore it. Perhaps you misspelled it. | ||
See the pgfkeys package documentation for explanation. | ||
Type H <return> for immediate help. | ||
... | ||
l. ...\pgfkeys{/baz} | ||
This error message was generated by an \errmessage | ||
command, so I can't give any explicit help. | ||
Pretend that you're Hercule Poirot: Examine all clues, | ||
and deduce the truth by order and method. | ||
============================================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters