Module Name: src
Committed By: kre
Date: Mon Sep 10 15:02:11 UTC 2018
Modified Files:
src/tests/usr.bin/printf: printf.sh t_builtin.sh
Log Message:
Add a test where printf is run twice in the same shell, and the
first invocation uses \c in a %b arg - make sure that 2nd invocation
is not affected by that (it was until recently, for a very long time).
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/printf/printf.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/printf/t_builtin.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/printf/printf.sh
diff -u src/tests/usr.bin/printf/printf.sh:1.1 src/tests/usr.bin/printf/printf.sh:1.2
--- src/tests/usr.bin/printf/printf.sh:1.1 Wed Sep 5 21:05:40 2018
+++ src/tests/usr.bin/printf/printf.sh Mon Sep 10 15:02:11 2018
@@ -1,4 +1,4 @@
-# $NetBSD: printf.sh,v 1.1 2018/09/05 21:05:40 kre Exp $
+# $NetBSD: printf.sh,v 1.2 2018/09/10 15:02:11 kre Exp $
#
# Copyright (c) 2018 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -1345,6 +1345,15 @@ b_SysV_echo_backslash_c()
# This is undefined, though would be nice if we could rely upon it
# expect "abcd" %.1b 'a\c' 'b\c' 'c\c' 'd\c' '\c' e
+ # Check for interference from one instance of execution of
+ # a builtin printf execution to another
+ # (this makes no sense to test for standalone printf, and for which
+ # the tests don't handle ';' magic args, so this would not work)
+ if $BUILTIN_TEST
+ then
+ expect abcdefjklmno %s%b%s abc 'def\c' ghi ';' %s%s jkl mno
+ fi
+
return $RVAL
}
define b_SysV_echo_backslash_c 'Use of \c in arg to %b format'
Index: src/tests/usr.bin/printf/t_builtin.sh
diff -u src/tests/usr.bin/printf/t_builtin.sh:1.2 src/tests/usr.bin/printf/t_builtin.sh:1.3
--- src/tests/usr.bin/printf/t_builtin.sh:1.2 Sat Sep 8 18:24:01 2018
+++ src/tests/usr.bin/printf/t_builtin.sh Mon Sep 10 15:02:11 2018
@@ -1,4 +1,4 @@
-# $NetBSD: t_builtin.sh,v 1.2 2018/09/08 18:24:01 kre Exp $
+# $NetBSD: t_builtin.sh,v 1.3 2018/09/10 15:02:11 kre Exp $
#
# Copyright (c) 2018 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -63,6 +63,9 @@ do_printf()
for ARG
do
case "${ARG}" in
+ (';') # Allow multiple commands
+ COMMAND="${COMMAND} ; printf"
+ ;;
(*\'*)
# This is kind of odd, we need a working
# printf in order to test printf ...