[PATCH] strerror_r: avoid corrupting errno on Solaris

2011-05-20 Thread Eric Blake
On Solaris, a non-zero return was also reflected into errno. Leaving errno unchanged is a useful feature worth guaranteeing. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Check for Solaris behavior. * doc/posix-functions/strerror_r.texi (strerror_r): Document it. Signed-off-by: Eric Blake --- This f

[PATCH] strerror_r: avoid compiler warning

2011-05-20 Thread Eric Blake
A couple of copy-and-paste issues led to a compiler warning during configure, detected on at least Solaris. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Don't return a char*. Signed-off-by: Eric Blake --- ChangeLog|5 - m4/strerror_r.m4 |5 ++--- 2 files changed, 6 insertions(+)

Re: [PATCH] strerror_r: simplify AIX code.

2011-05-20 Thread Eric Blake
On 05/20/2011 05:21 PM, Eric Blake wrote: > But both errors are allowed by POSIX, and we have the case that glibc's > __xpg_strerror_r favors EINVAL while cygwin's _xpg_strerror_r favors > ERANGE. The testsuite tests for both codes, because there is no > heirarchy in POSIX on which error code if m

Re: [PATCH] strerror_r: simplify AIX code.

2011-05-20 Thread Eric Blake
On 05/20/2011 04:50 PM, Bruno Haible wrote: > Hi Eric, > >> @@ -95,6 +95,15 @@ int >> strerror_r (int errnum, char *buf, size_t buflen) >> #undef strerror_r >> { >> + /* Filter this out now, so that rest of this replacement knows that >> + there is room for a non-empty message and trailing

[PATCH] strerror_r: enforce POSIX recommendations

2011-05-20 Thread Eric Blake
* lib/strerror_r.c (safe_copy): New helper method. (strerror_r): Guarantee a non-empty string. * tests/test-strerror_r.c (main): Enhance tests to incorporate recent POSIX rulings and to match our strerror guarantees. * doc/posix-functions/strerror_r.texi (strerror_r): Document this. --- This now p

Re: [PATCH] strerror_r: simplify AIX code.

2011-05-20 Thread Bruno Haible
Hi Eric, > @@ -95,6 +95,15 @@ int > strerror_r (int errnum, char *buf, size_t buflen) > #undef strerror_r > { > + /* Filter this out now, so that rest of this replacement knows that > + there is room for a non-empty message and trailing NUL. */ > + if (buflen <= 1) > +{ > + if (

Re: flymake support in gnulib

2011-05-20 Thread Reuben Thomas
On 20 May 2011 23:02, Eric Blake wrote: > > nul does not work anywhere besides Windows; elsewhere it is spelled > /dev/null. That's what I thought, but I couldn't find a file called "nul" created anywhere. However, I have now found it. D'oh. -- http://rrt.sc3d.org

Re: flymake support in gnulib

2011-05-20 Thread Eric Blake
On 05/20/2011 03:32 PM, Reuben Thomas wrote: > I've just been playing with flymake. To make it work at all I copied > the following rule into my src/Makefile.am from the flymake manual: > > check-syntax: > gcc -o nul -S ${CHK_SOURCES} > > Secondly, the -o nul option to gcc seems to be an >

flymake support in gnulib

2011-05-20 Thread Reuben Thomas
I've just been playing with flymake. To make it work at all I copied the following rule into my src/Makefile.am from the flymake manual: check-syntax: gcc -o nul -S ${CHK_SOURCES} It would be nice to put this in maint.mk, but then it wouldn't be picked up by make in src/, only at the top-

[PATCH] strerror_r: simplify AIX code.

2011-05-20 Thread Eric Blake
* lib/strerror_r.c (strerror_r): Filter out buflen of 1 up front. Signed-off-by: Eric Blake --- ChangeLog|3 +++ lib/strerror_r.c | 30 +- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 598238f..bda43a6 1006

Using a different allocator with gnulib

2011-05-20 Thread Reuben Thomas
The one I have in mind is libgc. It seems that -DREDIRECT_MALLOC=GC_malloc -DIGNORE_FREE is my only option right now; maybe it is also sufficient (since if I wanted to use libgc's own API, then I obviously wouldn't be using gnulib's APIs anyway)? -- http://rrt.sc3d.org

Re: circular dependency [was: perror bug]

2011-05-20 Thread Eric Blake
On 05/20/2011 12:42 PM, Bruno Haible wrote: > Hi Eric, > >> This change means that now strerror depends on strerror_r-posix, and >> strerror_r-posix depends on strerror. Is that circular dependency okay >> for gnulib-tool? > > Yes, gnulib-tool supports circular dependencies, even with > --condit

Re: circular dependency [was: perror bug]

2011-05-20 Thread Bruno Haible
Hi Eric, > This change means that now strerror depends on strerror_r-posix, and > strerror_r-posix depends on strerror. Is that circular dependency okay > for gnulib-tool? Yes, gnulib-tool supports circular dependencies, even with --conditional-dependencies. But the circular dependency was not

Re: proposed new module intprops-test

2011-05-20 Thread Paul Eggert
> With just the first 2 out of 3 commits (partial revert and work around IRIX > 6.5 > cc bug), IRIX 6.5 cc would still have complained ("The indicated constant > value > is not known.") about a combination of signed and unsigned integers, this time > with '|', not '+' ... and HP-UX cc would still

circular dependency [was: perror bug]

2011-05-20 Thread Eric Blake
On 05/18/2011 09:27 PM, Bruno Haible wrote: >> 1) The strerror_r replacement, when EXTEND_STRERROR_R is defined, >> clobbers the strerror function's buffer, which it shouldn't. > > Here comes the fix for 1). Tested on > > --- modules/strerror Thu May 19 04:13:54 2011 > *** > *

[PATCH 2/3] test-perror: check for strerror interactions

2011-05-20 Thread Eric Blake
This uncovered a glibc bug, although not many people check for perror failures, so for now I'm not working around it. http://sourceware.org/bugzilla/show_bug.cgi?id=12792 * tests/macros.h (STREQ) Add macro. * modules/perror-tests (Files): Add second test. * tests/test-perror2.c (main): New file. *

[PATCH 3/3] perror: work around FreeBSD bug

2011-05-20 Thread Eric Blake
POSIX requires that 'errno = 0; perror ("")' print the same message as strerror(0), but this failed if we were replacing strerror to work around the FreeBSD bug of treating 0 as a failure. * m4/perror.m4 (gl_FUNC_PERROR): Also replace perror if strerror_r is broken. Move AC_LIBOBJ... * modules/pe

[PATCH 1/3] test-perror: rewrite to use init script

2011-05-20 Thread Eric Blake
Make the test simpler, and also check for correct exit status. * modules/perror-tests (Files): Add init.sh. * tests/test-perror.sh: Use temporary directory. Signed-off-by: Eric Blake --- General cleanup. I thought about enhancing this test further, but then decided to go with a new test when I

Re: [PATCH 1/5] [mingw]: Add implementation of canonicalize_file_name.

2011-05-20 Thread Andy Wingo
Hello Jan, On Fri 20 May 2011 15:56, Jan Nieuwenhuizen writes: > Andy Wingo writes: > >> I read the thread and it looked like this patch was close to being >> accepted > > Yes, it looks like that. Heh ;) > My first simplistic patch to just make guile canonicalize_file_name work > on mingw took

Re: [PATCH] strerror_r: fix on newer cygwin

2011-05-20 Thread Eric Blake
On 05/19/2011 08:06 PM, Bruno Haible wrote: > Eric Blake wrote: >> More accurately: >> >> The change in strerror_r behavior was in 1.7.8 (which also tried to >> introduce __xpg_strerror_r), but a bug in the headers vs. export table >> ended up with a link failure for __xpg_strerror_r: >> http://cyg

Re: proposed new module intprops-test

2011-05-20 Thread Bruno Haible
Hi Paul, > Here's what I committed: With these patches, the test compiles and passes now also on HP-UX 11.23 with cc and IRIX 6.5 with cc. With just the first 2 out of 3 commits (partial revert and work around IRIX 6.5 cc bug), IRIX 6.5 cc would still have complained ("The indicated constant val

[PATCH 1/2] maint: correct misuse of "a" and "an"

2011-05-20 Thread Jim Meyering
FYI, these fix quite a few typos: >From c9ff025783e5374226ffbf7940f40ce7db6852ed Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 19 May 2011 22:18:05 +0200 Subject: [PATCH 1/2] maint: correct misuse of "a" and "an" * doc/regex.texi (Collating Symbol Operators): s/an close.../a close/ * li