[latex3-commits] [git/LaTeX3-latex3-latex3] main: Make \ior_map_inline:Nn complain when given an undefined stream (fixes #194) (3f0053160)
Bruno Le Floch
blflatex at gmail.com
Fri Apr 23 16:57:04 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/3f0053160bd83dba085844ef4345ed3f4c0513a1
>---------------------------------------------------------------
commit 3f0053160bd83dba085844ef4345ed3f4c0513a1
Author: Bruno Le Floch <blflatex at gmail.com>
Date: Fri Apr 23 16:57:04 2021 +0200
Make \ior_map_inline:Nn complain when given an undefined stream (fixes #194)
As described in the issue, this lack of error was a leftover from ancient times
where closed streams were simply undefined control sequences.
>---------------------------------------------------------------
3f0053160bd83dba085844ef4345ed3f4c0513a1
l3kernel/l3file.dtx | 26 +++++++++---------
l3kernel/testfiles/m3ior003.lvt | 7 ++++-
l3kernel/testfiles/m3ior003.tlg | 58 ++++++++++++++++++++++++++++++++++++++++-
3 files changed, 76 insertions(+), 15 deletions(-)
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index bc41896c0..0576d7816 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -1161,19 +1161,19 @@
% \begin{macrocode}
\prg_new_conditional:Npnn \ior_if_eof:N #1 { p , T , F , TF }
{
- \cs_if_exist:NTF #1
- {
- \int_compare:nTF { -1 < #1 < \c_@@_term_ior }
- {
- \if_eof:w #1
- \prg_return_true:
- \else:
- \prg_return_false:
- \fi:
- }
- { \prg_return_true: }
- }
- { \prg_return_true: }
+ \if_int_compare:w -1 < #1
+ \if_int_compare:w #1 < \c_@@_term_ior
+ \if_eof:w #1
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ \else:
+ \prg_return_true:
+ \fi:
+ \else:
+ \prg_return_true:
+ \fi:
}
% \end{macrocode}
% \end{macro}
diff --git a/l3kernel/testfiles/m3ior003.lvt b/l3kernel/testfiles/m3ior003.lvt
index cdec77445..42fbdff29 100644
--- a/l3kernel/testfiles/m3ior003.lvt
+++ b/l3kernel/testfiles/m3ior003.lvt
@@ -12,7 +12,7 @@
\begin{document}
\START
-\AUTHOR{Phelype Oleinik}
+\AUTHOR{Phelype Oleinik, Bruno Le Floch}
\ExplSyntaxOn
\TEST { \ior_(str_)get_term:nN }
@@ -39,4 +39,9 @@
\ior_close:N \tempread
}
+\TEST { undefined~stream~(github~194) }
+ {
+ { \ior_if_eof:NTF \undefined { } { } }
+ }
+
\END
diff --git a/l3kernel/testfiles/m3ior003.tlg b/l3kernel/testfiles/m3ior003.tlg
index a56980ef9..3b63c201d 100644
--- a/l3kernel/testfiles/m3ior003.tlg
+++ b/l3kernel/testfiles/m3ior003.tlg
@@ -1,6 +1,6 @@
This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
-Author: Phelype Oleinik
+Author: Phelype Oleinik, Bruno Le Floch
============================================================
TEST 1: \ior_ (str_)get_term:nN
============================================================
@@ -10,3 +10,59 @@ Defining \tempread on line ...
|Pleaseleaveitalone!|
|\ExplSyntaxOn |
============================================================
+============================================================
+TEST 2: undefined stream (github 194)
+============================================================
+! Undefined control sequence.
+<argument> \undefined
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \undefined
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Missing number, treated as zero.
+<to be read again>
+ <
+l. ... }
+A number should have been here; I inserted `0'.
+(If you can't figure out why I needed to see a number,
+look up `weird error' in the index to The TeXbook.)
+! Undefined control sequence.
+<argument> \undefined
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Missing number, treated as zero.
+<to be read again>
+ \relax
+l. ... }
+A number should have been here; I inserted `0'.
+(If you can't figure out why I needed to see a number,
+look up `weird error' in the index to The TeXbook.)
+! Missing number, treated as zero.
+<to be read again>
+ \relax
+l. ... }
+A number should have been here; I inserted `0'.
+(If you can't figure out why I needed to see a number,
+look up `weird error' in the index to The TeXbook.)
+! Missing number, treated as zero.
+<to be read again>
+ \relax
+l. ... }
+A number should have been here; I inserted `0'.
+(If you can't figure out why I needed to see a number,
+look up `weird error' in the index to The TeXbook.)
+============================================================
More information about the latex3-commits
mailing list.