# HG changeset patch # User Kamil Dudka # Date 1239293235 -7200 # Node ID 8557d9d3cace050ab22768763c8e22da45f0adc9 # Parent ecb28ce608f12e66e1f817e34783ac98664ae935 filevercmp: correct today's change * lib/filevercmp.c: Also handle coreutils' test inputs. * tests/test-filevercmp.c: Add inputs from one of coreutils' test scripts. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-04-09 Kamil Dudka + filevercmp: correct today's change + * lib/filevercmp.c: Also handle coreutils' test inputs. + * tests/test-filevercmp.c: Add inputs from one of coreutils' test scripts. + Fix regression in 'filevercmp' module. Thanks Sven Joachim for reporting it. * lib/filevercmp.c: Special handle for "", "." and "..". diff --git a/lib/filevercmp.c b/lib/filevercmp.c --- a/lib/filevercmp.c +++ b/lib/filevercmp.c @@ -149,6 +149,17 @@ if (0 == strcmp ("..", s2)) return 1; + /* special handle for other hidden files */ + if (*s1 == '.' && *s2 != '.') + return -1; + if (*s1 != '.' && *s2 == '.') + return 1; + if (*s1 == '.' && *s2 == '.') + { + s1++; + s2++; + } + /* "cut" file suffixes */ s1_pos = s1; s2_pos = s2; diff --git a/tests/test-filevercmp.c b/tests/test-filevercmp.c --- a/tests/test-filevercmp.c +++ b/tests/test-filevercmp.c @@ -40,10 +40,23 @@ "", ".", "..", + ".0", + ".9", + ".A", + ".Z", ".a~", ".a", ".b~", ".b", + ".z", + ".zz~", + ".zz", + ".zz.~1~", + ".zz.0", + "0", + "9", + "A", + "Z", "a~", "a", "a.b~", @@ -74,6 +87,11 @@ "nss_ldap-1.0-0.1a.tar.gz", "nss_ldap-10beta1.fc8.tar.gz", "nss_ldap-10.11.8.6.20040204cvs.fc10.ebuild", + "z", + "zz~", + "zz", + "zz.~1~", + "zz.0", "#.b#", NULL };