bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] gnulib string module problems on Debian stable, maybe o


From: Paul Eggert
Subject: Re: [bug-gnulib] gnulib string module problems on Debian stable, maybe other platforms
Date: Thu, 01 Feb 2007 16:30:49 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

> it can define GNULIB_STRSTR itself:
>
>   dnl Tell gnulib that the non-i18n implementation of strstr() is enough
>   dnl for our purposes.
>   AC_DEFINE([GNULIB_STRSTR], 1)

This sounds a bit fragile.  mountlist can use a non-i18n
version of strstr but maybe some mountlist-using apps can't.
So it doesn't sound plausible to put
AC_DEFINE([GNULIB_STRSTR], 1) into mountlist.m4.
It'd have to be in the app's configure.ac; but this
requires the app to know gnulib's internals.

>> How about if we remove the
>> strstr_is_unportable__use_gnulib_module_strcasestr_for_portability
>> symbols?
>
> They serve the purpose of detecting portability problems.

OK, but there are two categories of users here.
First, maintainers want to detect portability problems.
Second, installers don't want to be bothered about
portability problems that do not apply to their platforms.
The current approach caters to maintainers but will cause
problems for installers.  In the long run this means we'll
have tarballs leading to installation failures in the field
that are entirely avoidable.

Also, to be honest it's getting a bit hard for me to
follow/understand all this stuff.  I'd like something
simpler, or at least something more consistent.  When
maintaining this stuff I get lost about the distinction
between GNULIB_STRSTR versus REPLACE_STRSTR versus
HAVE_DECL_STRSTR versus DECL_STRSTR versus 'defined strstr".
All these identifiers have their roles which make sense
individually, but the combination is a bit much.

How about something along the following lines instead?  It
tries to be simpler, or at least more consistent.  This
would be put in string_.h, for each function that string_.h
declares.

  #if @REPLACE_STRSTR@
  # undef strstr
  # define strstr @address@hidden
  #endif
  #if @REPLACE_STRSTR@ || ! @HAVE_DECL_STRSTR@
  extern char *strstr (char const *__haystack, char const *__needle);
  #endif

@REPLACE_STRSTR@ is:

  1 if configure determines that
    we need to replace the system strlen

  0 if configure checked the system strlen and found
    it to be OK.

  _GL_CHECK_PORTABILITY otherwise.

  Maintainers can compile with -D_GL_CHECK_PORTABILITY to
  enable portability checking.

@RPL_@ is normally rpl_ but could be something else if we
want to support multiple libraries.

@HAVE_DECL_STRSTR@ is as now.

> I think it would be actually good to introduce a module
> called, say, 'posixcheck' (or a gnulib-tool option) that
> would generalize this technique from string.h to all other
> headers that declare POSIX functions for which gnulib has
> a replacement.

In the approach I outlined above, -D_GL_CHECK_PORTABILITY
would take the approximate role of posixcheck.




reply via email to

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