summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2016-10-11 19:31:15 +0000
committermartijn <martijn@openbsd.org>2016-10-11 19:31:15 +0000
commitf9efd6f5aa953b37d671682fe2614c36ac51870e (patch)
treec7c815a51d25d71cb4976459cc0615b4dbd7e713
parentFix an off by one error when no matches were found in a substitute. (diff)
downloadwireguard-openbsd-f9efd6f5aa953b37d671682fe2614c36ac51870e.tar.xz
wireguard-openbsd-f9efd6f5aa953b37d671682fe2614c36ac51870e.zip
Add a regression test for the off by one bug reported by pfg.
Based on the example presented by pfg. OK otto@
-rw-r--r--regress/usr.bin/sed/sedtest.expected5
-rw-r--r--regress/usr.bin/sed/sedtest.sh5
2 files changed, 9 insertions, 1 deletions
diff --git a/regress/usr.bin/sed/sedtest.expected b/regress/usr.bin/sed/sedtest.expected
index a60cff15fc5..4d129a02936 100644
--- a/regress/usr.bin/sed/sedtest.expected
+++ b/regress/usr.bin/sed/sedtest.expected
@@ -4564,3 +4564,8 @@ X[_14
Test 8.20:189
=============
a-b-c
+
+=============
+Test 8.21:190
+=============
+z
diff --git a/regress/usr.bin/sed/sedtest.sh b/regress/usr.bin/sed/sedtest.sh
index e8fcf5b6356..0efc342fe05 100644
--- a/regress/usr.bin/sed/sedtest.sh
+++ b/regress/usr.bin/sed/sedtest.sh
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $OpenBSD: sedtest.sh,v 1.5 2010/07/03 02:34:36 phessler Exp $
+# $OpenBSD: sedtest.sh,v 1.6 2016/10/11 19:31:15 martijn Exp $
#
# Copyright (c) 1992 Diomidis Spinellis.
# Copyright (c) 1992, 1993
@@ -420,6 +420,9 @@ u2/g' lines1
mark '8.20'
printf 'a\\b(c\n' |
$SED 'y%ABCDEFGHIJKLMNOPQRSTUVWXYZ, /\\()"%abcdefghijklmnopqrstuvwxyz,------%'
+ mark '8.21'
+# Test if an unmatched line is only printed once.
+ printf 'z\n' | $SED -e 's/^a*/b/2p'
}
test_error()