bug-coreutils
[Top][All Lists]
Advanced

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

Re: sort --version-sort


From: Eric Blake
Subject: Re: sort --version-sort
Date: Tue, 19 Aug 2008 16:28:08 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Jim Meyering <jim <at> meyering.net> writes:

> > But I disagree about what a portable app
> > should expect - the point of gnulib replacement headers is that we guarantee
> > that <string.h> will portably declare strverscmp.  For comparison, look at 
how
> > we rely on the gnulib headers for other GNU extensions such as strcasestr.
> 
> I wondered if there were any GNU-specific functions, and even searched
> for *GNU* macros that might guard their declarations in string.in.h.
> There are none.  The main difference is that strcasestr is specified by
> POSIX and a declaration in string.h is required, while strverscmp is not.

Wrong.  strcasecmp is specified by POSIX (in <strings.h>), but strcasestr is 
pure GNU extension (at least for now).  The gnulib <string.h> also provides 
declarations for mbs* functions, also an extension.

One thing to note about the gnulib headers is that they only declare the 
extension if you use the module providing the implementation; it is still 
possible to goof if you develop on Linux, use strverscmp, but forget to use the 
gnulib strverscmp module; but that's why Bruno added the notion of 
GNULIB_POSIXCHECK in the .in.h headers to help catch those sorts of errors.  
Under that argument, ALL extensions available on one platform but not all, 
should be explicitly called out in string.in.h at least for the 
GNULIB_POSIXCHECK warning capability.

> 
> I think it would be a mistake to encourage gnulib application writers
> to rely on <string.h> declaring the nonstandard strverscmp function.

I still disagree - I see gnulib as a way to make non-GNU platforms behave more 
like GNU/Linux, so that developers using Linux need not remember rules about 
which functions need separate headers.  In other words, if Linux does it, 
gnulib should consider doing it too.

> 
> However, if you can convince the open group to add it for POSIX-201x,
> it'd make perfect sense to add it to gnulib's string.in.h now.

Yes, there is a good shot that when POSIX reopens for additions in a few years, 
that I will help propose strcasestr, strverscmp, and Bruno's mbs* functions, 
among others, for standardization.  And we have a good shot of getting them in; 
look at how POSIX 200x added strdup and several other GNU inventions.

> 
> > Besides, fixing it in gnulib will benefit any other package developed 
primarily
> > on Linux but which forgets to include "strverscmp.h". So I'm going ahead 
with
> > a gnulib patch... oh, and I guess that means I'm also volunteering to write 
a
> > gnulib unit test for strverscmp...
> 
> Test suite additions are always welcome 
> 

I posted the gnulib patch in two pieces; if you still disagree about which 
header to use, then the second commit can still be used as a testsuite with a 
one-line addition.  Meanwhile, if you decide to go with my arguments, you need 
this patch for coreutils (plus a second cleanup patch for 'git status'):

git pull git://repo.or.cz/coreutils/ericb.git ls

>From 4f9adb185a5b4205164eccef8f958e0fdcd5abb1 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 19 Aug 2008 09:58:34 -0600
Subject: [PATCH] ls: adjust to gnulib change

* src/ls.c (includes): "strverscmp.h" no longer exists.

Signed-off-by: Eric Blake <address@hidden>
---
 src/ls.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/ls.c b/src/ls.c
index 9261f62..aeece67 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -105,7 +105,6 @@
 #include "same.h"
 #include "stat-time.h"
 #include "strftime.h"
-#include "strverscmp.h"
 #include "xstrtol.h"
 #include "areadlink.h"
 
-- 
1.5.6.4


>From 64ac5ca396c16d5b9bda2ee58655eeb5b0fa87e7 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 19 Aug 2008 10:00:38 -0600
Subject: [PATCH] .gitignore: ignore more files

* .gitignore: Ignore directories created by gnulib.

Signed-off-by: Eric Blake <address@hidden>
---
 .gitignore |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index a14320b..9190ce3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,6 +44,7 @@ coreutils-*.tar.lzma.sig
 gnulib-tests
 lib/.cvsignore
 lib/.gitignore
+lib/arpa
 lib/binary-io.h
 lib/charset.alias
 lib/configmake.h
@@ -52,6 +53,7 @@ lib/printf.c
 lib/progname.c
 lib/progname.h
 lib/selinux
+lib/uniwidth
 m4/.cvsignore
 m4/.gitignore
 po/*.gmo
-- 
1.5.6.4








reply via email to

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