[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] cmp (diffutils) cannot compare two portions in the same file.
From: |
Hideki IWAMOTO |
Subject: |
[PATCH] cmp (diffutils) cannot compare two portions in the same file. |
Date: |
Thu, 11 Mar 2004 00:51:01 +0900 |
The current implementation always returns 0,
even if offsets differ, if file names are same.
[diffutils-2.8.4]
# cmp -n 1G /dev/hdb /dev//hdb 2G 3G
/dev/hdb /dev//hdb differ: char 1, line 1
# cmp -n 1G /dev/hdb /dev/hdb 2G 3G
[patched version]
# cmp -n 1G /dev/hdb /dev//hdb 2G 3G
/dev/hdb /dev//hdb differ: char 1, line 1
# cmp -n 1G /dev/hdb /dev/hdb 2G 3G
/dev/hdb /dev/hdb differ: char 1, line 1
--- diffutils-2.8.4.org/src/cmp.c 2002-06-17 15:45:46.000000000 +0900
+++ diffutils-2.8.4/src/cmp.c 2004-03-11 00:31:51.000000000 +0900
@@ -275,7 +275,8 @@
/* Two files with the same name are identical.
But wait until we open the file once, for proper diagnostics. */
- if (f && file_name_cmp (file[0], file[1]) == 0)
+ if (f && file_name_cmp (file[0], file[1]) == 0
+ && ignore_initial[0] == ignore_initial[1])
return EXIT_SUCCESS;
file_desc[f1] = (strcmp (file[f1], "-") == 0
----
Hideki IWAMOTO address@hidden
- [PATCH] cmp (diffutils) cannot compare two portions in the same file.,
Hideki IWAMOTO <=