bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCHv2] strerror: drop strerror_r dependency


From: Bruno Haible
Subject: Re: [PATCHv2] strerror: drop strerror_r dependency
Date: Sat, 4 Jun 2011 02:28:12 +0200
User-agent: KMail/1.9.9

Hi Eric,

> Since the errno module is responsible for introducing replacement
> errno values, it should also be responsible for translating those
> new values into strings.  And by moving the replacements into a
> file managed by the errno, we can then break the dependency between
> strerror and strerror_r, so that strerror no longer drags in
> multi-threading modules required by strerror_r.

Creating a separate strerror-override.[hc] is reasonable.

However, I'm not in favour of attaching object files to modules that
are meant to provide a header file. For two reasons:
  - Not everyone who needs 'errno' also needs strerror() or strerror_r().
    There are many uses, from iconv() to <pthread.h>, of errno values
    without the need of a conversion to string.
  - This change causes trouble for the 'relocatable-prog-wrapper'
    module. This module is meant to have all its source code compiled
    on the fly and not provide any object file into libgnu.a (i.e.
    no AC_LIBOBJ invocations).

Please, can we revisit this?

Another point with this patch is that it leads to a link error of the
gettext build on OpenBSD 4.4:

/bin/sh ../libtool  --tag=CC    --mode=link gcc -std=gnu99  -g -O2    -o 
gettextpo-1-prg gettextpo_1_prg-gettextpo-1-prg.o 
../libgettextpo/libgettextpo.la ../intl/libintl.la 
libtool: link: gcc -std=gnu99 -g -O2 -o .libs/gettextpo-1-prg 
gettextpo_1_prg-gettextpo-1-prg.o  
-L/home/haible/multibuild-1028/openbsd44/gettext-0.18.1/gettext-tools/intl/.libs
 -L../libgettextpo/.libs -lgettextpo -L/usr/local/lib -L../intl/.libs -lintl 
-liconv -Wl,-rpath,/usr/local/lib
../libgettextpo/.libs/libgettextpo.so.5.1: warning: strcpy() is almost always 
misused, please use strlcpy()
../libgettextpo/.libs/libgettextpo.so.5.1: warning: sprintf() is often misused, 
please use snprintf()
../libgettextpo/.libs/libgettextpo.so.5.1: undefined reference to 
`libgettextpo_strerror_override'
collect2: ld returned 1 exit status
*** Error code 1

This undefined reference occurs because the config.h file for libgettextpo
contains definitions like
  #define strerror_override libgettextpo_strerror_override
that achieve namespace cleanliness of the shared libraries, and
lib/strerror-override.c breaks this
  1. by omitting the mandatory '#include <confog.h>,
  2. by explicitly doing a #undef.

Both needs to be fixed. I plan to push this once savannah is back:


2011-06-03  Bruno Haible  <address@hidden>

        strerror-override: Don't disable symbol renamings.
        * lib/strerror-override.c: Include config.h.
        (strerror_override): Don't undefine.

--- lib/strerror-override.c.orig        Sat Jun  4 02:17:13 2011
+++ lib/strerror-override.c     Sat Jun  4 02:16:46 2011
@@ -17,6 +17,8 @@
 
 /* Written by Bruno Haible <address@hidden>, 2010.  */
 
+#include <config.h>
+
 #include "strerror-override.h"
 
 #include <errno.h>
@@ -27,10 +29,6 @@
 # endif
 #endif
 
-/* This undefine allows testing with gl_cv_header_errno_h_complete=no on
-   a system that otherwise has a complete errno.h.  */
-#undef strerror_override
-
 /* If ERRNUM maps to an errno value defined by gnulib, return a string
    describing the error.  Otherwise return NULL.  */
 const char *

-- 
In memoriam Leo Katzenberger <http://en.wikipedia.org/wiki/Katzenberger_Trial>



reply via email to

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