Module Name:    src
Committed By:   rillig
Date:           Sun Feb  7 20:27:40 UTC 2021

Modified Files:
        src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libcurses/director/testlang_conf.l

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.13 src/tests/lib/libcurses/director/testlang_conf.l:1.14
--- src/tests/lib/libcurses/director/testlang_conf.l:1.13	Sun Feb  7 19:49:32 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Feb  7 20:27:40 2021
@@ -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 <[email protected]>
@@ -380,7 +380,12 @@ include		BEGIN(incl);
 		}
 
 .		{
-			/* 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]);
 		}
 
 %%

Reply via email to