bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls -v is still inconsistent


From: Jim Meyering
Subject: Re: ls -v is still inconsistent
Date: Tue, 24 Mar 2009 21:44:25 +0100

Kamil Dudka wrote:
> From d889021cebb7bf798d1b7bf24149c354627e9553 Mon Sep 17 00:00:00 2001
> From: Kamil Dudka <address@hidden>
> Date: Fri, 20 Mar 2009 11:20:12 +0100
> Subject: [PATCH] filevercmp: extension for simple and numbered backups

Hi Kamil,

Thanks again.
Complete patch below.
I'm merging this incremental, to retain (per Bruno's suggestion)
the two test cases you removed.
I'll add the ChangeLog entry, of course.

diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index b1ceab6..99c07db 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -1,7 +1,7 @@
 /*
    Copyright (C) 1995 Ian Jackson <address@hidden>
    Copyright (C) 2001 Anthony Towns <address@hidden>
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/filevercmp.h b/lib/filevercmp.h
index 9568d15..f3d78f0 100644
--- a/lib/filevercmp.h
+++ b/lib/filevercmp.h
@@ -1,7 +1,7 @@
 /*
    Copyright (C) 1995 Ian Jackson <address@hidden>
    Copyright (C) 2001 Anthony Towns <address@hidden>
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/tests/test-filevercmp.c b/tests/test-filevercmp.c
index 45a594b..9933b8a 100644
--- a/tests/test-filevercmp.c
+++ b/tests/test-filevercmp.c
@@ -1,5 +1,5 @@
 /* Test of filevercmp() function.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -51,8 +51,10 @@ static const char *const examples[] =
   "a.bc",
   "b~",
   "b",
+  "gcc-c++-10.fc9.tar.gz",
   "gcc-c++-10.fc9.tar.gz.~1~",
   "gcc-c++-10.fc9.tar.gz.~2~",
+  "gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2",
   "gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2.~1~",
   "glibc-2-0.1.beta1.fc10.rpm",
   "glibc-common-5-0.2.beta2.fc9.ebuild",

Here's the full patch:

>From 0706723e4cd3eef54264d21bc1b8ab7165c8f088 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <address@hidden>
Date: Fri, 20 Mar 2009 11:20:12 +0100
Subject: [PATCH] filevercmp: handle simple~ and numbered.~3~ backup suffixes

* lib/filevercmp.c: Handle simple~ and numbered.~3~ backup suffixes.
* tests/test-filevercmp.c: Add tests for backup suffixes.
---
 lib/filevercmp.c        |    8 ++++----
 lib/filevercmp.h        |    4 ++--
 tests/test-filevercmp.c |    9 ++++++++-
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index 7b40c98..99c07db 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -1,7 +1,7 @@
 /*
    Copyright (C) 1995 Ian Jackson <address@hidden>
    Copyright (C) 2001 Anthony Towns <address@hidden>
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
 #include <limits.h>

 /* Match a file suffix defined by this regular expression:
-   /(\.[A-Za-z][A-Za-z0-9]*)*$/
+   /(\.[A-Za-z~][A-Za-z0-9~]*)*$/
    Scan the string *STR and return a pointer to the matching suffix, or
    NULL if not found.  Upon return, *STR points to terminating NUL.  */
 static const char *
@@ -40,7 +40,7 @@ match_suffix (const char **str)
       if (read_alpha)
         {
           read_alpha = false;
-          if (!c_isalpha (**str))
+          if (!c_isalpha (**str) && '~' != **str)
             match = NULL;
         }
       else if ('.' == **str)
@@ -49,7 +49,7 @@ match_suffix (const char **str)
           if (!match)
             match = *str;
         }
-      else if (!c_isalnum (**str))
+      else if (!c_isalnum (**str) && '~' != **str)
         match = NULL;
       (*str)++;
     }
diff --git a/lib/filevercmp.h b/lib/filevercmp.h
index 569b4d0..f3d78f0 100644
--- a/lib/filevercmp.h
+++ b/lib/filevercmp.h
@@ -1,7 +1,7 @@
 /*
    Copyright (C) 1995 Ian Jackson <address@hidden>
    Copyright (C) 2001 Anthony Towns <address@hidden>
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@
    It returns number >0 for S1 > S2, 0 for S1 == S2 and number <0 for S1 < S2.

    This function compares strings, in a way that if VER1 and VER2 are version
-   numbers and PREFIX and SUFFIX (SUFFIX defined as (\.[A-Za-z][A-Za-z0-9]*)*)
+   numbers and PREFIX and SUFFIX (SUFFIX defined as 
(\.[A-Za-z~][A-Za-z0-9~]*)*)
    are strings then VER1 < VER2 implies filevercmp (PREFIX VER1 SUFFIX,
    PREFIX VER2 SUFFIX) < 0.

diff --git a/tests/test-filevercmp.c b/tests/test-filevercmp.c
index fe54dc2..9933b8a 100644
--- a/tests/test-filevercmp.c
+++ b/tests/test-filevercmp.c
@@ -1,5 +1,5 @@
 /* Test of filevercmp() function.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -45,10 +45,17 @@ static const char *const examples[] =
   ".b",
   "a~",
   "a",
+  "a.b~",
+  "a.b",
+  "a.bc~",
+  "a.bc",
   "b~",
   "b",
   "gcc-c++-10.fc9.tar.gz",
+  "gcc-c++-10.fc9.tar.gz.~1~",
+  "gcc-c++-10.fc9.tar.gz.~2~",
   "gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2",
+  "gcc-c++-10.8.12-0.7rc2.fc9.tar.bz2.~1~",
   "glibc-2-0.1.beta1.fc10.rpm",
   "glibc-common-5-0.2.beta2.fc9.ebuild",
   "glibc-common-5-0.2b.deb",
--
1.6.2.rc1.285.gc5f54




reply via email to

[Prev in Thread] Current Thread [Next in Thread]