On Thursday 09 of April 2009 15:39:57 Jim Meyering wrote: > Like last time, I applied your patch in gnulib before running coreutils' > tests. I noticed the new resulting failure.
Apologize. The regression fix has caused another regression, it's ridiculous. An incremental fix is attached. What about merging the coreutils test suite into gnulib? The gnulib test algorithm is much more sensitive to these oddities. It compares each string with each other O(n^2) in contrast to sort with O(n*log n). It runs filevrcmp 3136x, but it still takes around 0.002s on my laptop. If you want to merge the tests, the second patch does it. Kamil
From 079b6a1e5997fd0f42fe824b0e02861b78c6e9c6 Mon Sep 17 00:00:00 2001 From: Kamil Dudka <kdu...@redhat.com> Date: Thu, 9 Apr 2009 18:07:15 +0200 Subject: [PATCH] filevercmp: fix regression --- lib/filevercmp.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/lib/filevercmp.c b/lib/filevercmp.c index caa4891..20522d1 100644 --- a/lib/filevercmp.c +++ b/lib/filevercmp.c @@ -149,6 +149,17 @@ filevercmp (const char *s1, const char *s2) 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; -- 1.6.2.2
From 23477fa0ecbe7dfaccc242fb835fbc67dc1d4b02 Mon Sep 17 00:00:00 2001 From: Kamil Dudka <kdu...@redhat.com> Date: Thu, 9 Apr 2009 18:17:13 +0200 Subject: [PATCH] filevercmp: merge coreutils tests into gnulib --- tests/test-filevercmp.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/tests/test-filevercmp.c b/tests/test-filevercmp.c index 700e182..ca88eb3 100644 --- a/tests/test-filevercmp.c +++ b/tests/test-filevercmp.c @@ -40,10 +40,23 @@ static const char *const examples[] = "", ".", "..", + ".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 @@ static const char *const examples[] = "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 }; -- 1.6.2.2