summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-07-24 10:18:28 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-07-24 10:18:54 -0700
commitffd63aedad3c0eb08ebb27103e5f242f8732dc0c (patch)
treef8cf7b097768e72f7fa06def4df5c8f9dc50fc41 /tests
parent612db4defaabc086f0c4303499dc41aee003fc69 (diff)
downloaddiffutils-ffd63aedad3c0eb08ebb27103e5f242f8732dc0c.tar.gz
cmp: fix bug in -b diagnostic
Problem reported by mancha (Bug#32249). * src/cmp.c (count_newlines): Restore old value of sentinel. * tests/cmp: Test for the bug.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cmp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/cmp b/tests/cmp
index 160c1ea..ca0fe5e 100755
--- a/tests/cmp
+++ b/tests/cmp
@@ -208,4 +208,14 @@ done >out1
compare exp1 out1 || fail=1
+printf 'bad\n' >bad
+printf 'bug\n' >bug
+echo LC_ALL=C cmp -b bad bug
+LC_ALL=C cmp -b bad bug
+test $? -eq 1 || fail=1
+case `LC_ALL=C cmp -b bad bug` in
+ 'bad bug differ: byte 2, line 1 is '*' a '*' u') ;;
+ *) echo 'expected cmp -b to report a and u'; fail=1;;
+esac
+
Exit $fail