Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146494773
D16451.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D16451.id.diff
View Options
Index: head/usr.bin/diff/diffreg.c
===================================================================
--- head/usr.bin/diff/diffreg.c
+++ head/usr.bin/diff/diffreg.c
@@ -720,19 +720,22 @@
}
ctold++;
ctnew++;
- if (flags & D_STRIPCR) {
+ if (flags & D_STRIPCR && (c == '\r' || d == '\r')) {
if (c == '\r') {
if ((c = getc(f1)) == '\n') {
- ctnew++;
- break;
+ ctold++;
+ } else {
+ ungetc(c, f1);
}
}
if (d == '\r') {
if ((d = getc(f2)) == '\n') {
- ctold++;
- break;
+ ctnew++;
+ } else {
+ ungetc(d, f2);
}
}
+ break;
}
if ((flags & D_FOLDBLANKS) && isspace(c) &&
isspace(d)) {
Index: head/usr.bin/diff/tests/diff_test.sh
===================================================================
--- head/usr.bin/diff/tests/diff_test.sh
+++ head/usr.bin/diff/tests/diff_test.sh
@@ -8,6 +8,7 @@
atf_test_case group_format
atf_test_case side_by_side
atf_test_case brief_format
+atf_test_case b230049
simple_body()
{
@@ -52,6 +53,15 @@
diff -u9999 -L input_c1.in -L input_c2.in "$(atf_get_srcdir)/input_c1.in" "$(atf_get_srcdir)/input_c2.in"
}
+b230049_body()
+{
+ printf 'a\nb\r\nc\n' > b230049_a.in
+ printf 'a\r\nb\r\nc\r\n' > b230049_b.in
+ atf_check -o empty -s eq:0 \
+ diff -up --strip-trailing-cr -L b230049_a.in -L b230049_b.in \
+ b230049_a.in b230049_b.in
+}
+
header_body()
{
export TZ=UTC
@@ -150,4 +160,5 @@
atf_add_test_case group_format
atf_add_test_case side_by_side
atf_add_test_case brief_format
+ atf_add_test_case b230049
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 4, 3:38 AM (7 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29225152
Default Alt Text
D16451.id.diff (1 KB)
Attached To
Mode
D16451: Improve --strip-trailing-cr handling
Attached
Detach File
Event Timeline
Log In to Comment