summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2016-02-22 19:31:39 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2016-02-22 19:31:39 +0000
commit49011cab98d485eb981076c871c0a6ca0daf4a84 (patch)
tree379001f1c672358818c9225b269f617b1ea51d64 /regress
parentceedca6f43776a7ce90db20acb1e65bc6855033c (diff)
Properly handle ed-files which fully replace input file content. This
misbehaviour is triggered with 'c' and 'i' commands on empty buffers. Spotted and fixed by Martin Natano <natano at natano dot net>. ok millert@
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/patch/Makefile7
-rw-r--r--regress/usr.bin/patch/t18.diff10
-rw-r--r--regress/usr.bin/patch/t18.in3
-rw-r--r--regress/usr.bin/patch/t18.out5
4 files changed, 22 insertions, 3 deletions
diff --git a/regress/usr.bin/patch/Makefile b/regress/usr.bin/patch/Makefile
index bfe2b8013d8..28a8e28048a 100644
--- a/regress/usr.bin/patch/Makefile
+++ b/regress/usr.bin/patch/Makefile
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.9 2015/10/13 17:07:05 tobias Exp $
+# $OpenBSD: Makefile,v 1.10 2016/02/22 19:31:38 tobias Exp $
PATCH=patch
PATCHOPTIONS=-sN
-REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17
+REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18
# .in: input file
# .diff: patch
@@ -23,7 +23,8 @@ REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17
# t14: diff in normal diff format.
# t15: diff in context diff format.
# t16: diff in ed format.
-# t17: diff in ed format that inserts a dot-line
+# t17: diff in ed format that inserts a dot-line.
+# t18: diff in ed format that fully replaces input content.
all: clean ${REGRESS_TARGET}
diff --git a/regress/usr.bin/patch/t18.diff b/regress/usr.bin/patch/t18.diff
new file mode 100644
index 00000000000..840b707ac53
--- /dev/null
+++ b/regress/usr.bin/patch/t18.diff
@@ -0,0 +1,10 @@
+1,3c
+W
+X
+..
+.
+3s/.//
+3a
+Y
+Z
+.
diff --git a/regress/usr.bin/patch/t18.in b/regress/usr.bin/patch/t18.in
new file mode 100644
index 00000000000..b1e67221afe
--- /dev/null
+++ b/regress/usr.bin/patch/t18.in
@@ -0,0 +1,3 @@
+A
+B
+C
diff --git a/regress/usr.bin/patch/t18.out b/regress/usr.bin/patch/t18.out
new file mode 100644
index 00000000000..33921bb2ebd
--- /dev/null
+++ b/regress/usr.bin/patch/t18.out
@@ -0,0 +1,5 @@
+W
+X
+.
+Y
+Z