Page MenuHomeFreeBSD

D37079.id112082.diff
No OneTemporary

D37079.id112082.diff

diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -709,10 +709,10 @@
* in one file for -b or -w.
*/
if (flags & (D_FOLDBLANKS | D_IGNOREBLANKS)) {
- if (c == EOF && d == '\n') {
+ if (c == EOF && isspace(d)) {
ctnew++;
break;
- } else if (c == '\n' && d == EOF) {
+ } else if (isspace(c) && d == EOF) {
ctold++;
break;
}
diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh
--- a/usr.bin/diff/tests/diff_test.sh
+++ b/usr.bin/diff/tests/diff_test.sh
@@ -22,6 +22,7 @@
atf_test_case functionname
atf_test_case noderef
atf_test_case ignorecase
+atf_test_case crlfeol
simple_body()
{
@@ -334,6 +335,14 @@
atf_check -o empty -s exit:0 diff -u -r --ignore-file-name-case A B
}
+crlfeol_body()
+{
+ printf 'hello world\r\n' > a
+ printf 'hello world' > b
+
+ atf_check -o empty -s exit:0 diff -b a b
+}
+
atf_init_test_cases()
{
atf_add_test_case simple
@@ -358,4 +367,5 @@
atf_add_test_case functionname
atf_add_test_case noderef
atf_add_test_case ignorecase
+ atf_add_test_case crlfeol
}

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 2, 7:45 AM (1 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30714487
Default Alt Text
D37079.id112082.diff (1 KB)

Event Timeline