Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libcurses/director tests/libcurses: error out on t...
details: https://anonhg.NetBSD.org/src/rev/88e4394f75cb
branches: trunk
changeset: 959319:88e4394f75cb
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Feb 07 20:27:40 2021 +0000
description:
tests/libcurses: error out on trying to parse /dev/zero
Be strict when parsing the tests. Any unknown character is an error.
This avoids an endless loop when running "./director /dev/zero". There
is no point in silently ignoring other invalid characters as well, as
this would only leave potential test writers in an unclear state,
without any benefit.
diffstat:
tests/lib/libcurses/director/testlang_conf.l | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (24 lines):
diff -r 2039937459a5 -r 88e4394f75cb tests/lib/libcurses/director/testlang_conf.l
--- a/tests/lib/libcurses/director/testlang_conf.l Sun Feb 07 20:20:06 2021 +0000
+++ b/tests/lib/libcurses/director/testlang_conf.l Sun Feb 07 20:27:40 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: testlang_conf.l,v 1.13 2021/02/07 19:49:32 rillig Exp $ */
+/* $NetBSD: testlang_conf.l,v 1.14 2021/02/07 20:27:40 rillig Exp $ */
/*-
* Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -380,7 +380,12 @@
}
. {
- /* FIXME: report syntax error */
+ if (isprint((unsigned char)yytext[0]))
+ errx(1, "%s:%zu: Invalid character '%c'",
+ cur_file, line + 1, yytext[0]);
+ else
+ errx(1, "%s:%zu: Invalid character '0x%02x'",
+ cur_file, line + 1, yytext[0]);
}
%%
Home |
Main Index |
Thread Index |
Old Index