Page MenuHomeFreeBSD

D34203.1793625867.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D34203.1793625867.diff

Index: usr.bin/diff/diffdir.c
===================================================================
--- usr.bin/diff/diffdir.c
+++ usr.bin/diff/diffdir.c
@@ -216,9 +216,11 @@
buf1[len1] = '\0';
buf2[len2] = '\0';
- if (len1 != len2 || strncmp(buf1, buf2, len1) != 0)
+ if (len1 != len2 || strncmp(buf1, buf2, len1) != 0) {
printf("Symbolic links %s and %s differ\n",
path1, path2);
+ status |= 1;
+ }
return;
}
@@ -226,10 +228,11 @@
printf("File %s is a %s while file %s is a %s\n",
path1, S_ISLNK(stb1.st_mode) ? "symbolic link" :
(S_ISDIR(stb1.st_mode) ? "directory" :
- (S_ISREG(stb1.st_mode) ? "link" : "error")),
+ (S_ISREG(stb1.st_mode) ? "file" : "error")),
path2, S_ISLNK(stb2.st_mode) ? "symbolic link" :
(S_ISDIR(stb2.st_mode) ? "directory" :
(S_ISREG(stb2.st_mode) ? "file" : "error")));
+ status |= 1;
return;
}
} else {
Index: usr.bin/diff/tests/diff_test.sh
===================================================================
--- usr.bin/diff/tests/diff_test.sh
+++ usr.bin/diff/tests/diff_test.sh
@@ -19,6 +19,7 @@
atf_test_case report_identical
atf_test_case non_regular_file
atf_test_case binary
+atf_test_case noderef
simple_body()
{
@@ -278,6 +279,35 @@
atf_check -o inline:"176c\nx\n.\n" -s exit:1 diff -ae A B
}
+noderef_body()
+{
+ atf_check mkdir A B
+
+ atf_check -x "echo 1 > A/test-file"
+ atf_check -x "echo 1 > test-file"
+ atf_check -x "echo 1 > test-file2"
+
+ atf_check ln -s $(pwd)/test-file B/test-file
+
+ atf_check -o empty -s exit:0 diff -r A B
+ atf_check -o inline:"File A/test-file is a file while file B/test-file is a symbolic link\n" \
+ -s exit:1 diff -r --no-dereference A B
+
+ # both test files are now the same symbolic link
+ atf_check rm A/test-file
+
+ atf_check ln -s $(pwd)/test-file A/test-file
+ atf_check -o empty -s exit:0 diff -r A B
+ atf_check -o empty -s exit:0 diff -r --no-dereference A B
+
+ # make test files different symbolic links, but same contents
+ atf_check unlink A/test-file
+ atf_check ln -s $(pwd)/test-file2 A/test-file
+
+ atf_check -o empty -s exit:0 diff -r A B
+ atf_check -o inline:"Symbolic links A/test-file and B/test-file differ\n" -s exit:1 diff -r --no-dereference A B
+}
+
atf_init_test_cases()
{
atf_add_test_case simple
@@ -299,4 +329,5 @@
atf_add_test_case report_identical
atf_add_test_case non_regular_file
atf_add_test_case binary
+ atf_add_test_case noderef
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 2, 1:24 PM (15 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41328560
Default Alt Text
D34203.1793625867.diff (2 KB)

Event Timeline