bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: HAVE_ICONV not defined by 'iconv.m4'


From: Bruno Haible
Subject: Re: HAVE_ICONV not defined by 'iconv.m4'
Date: Sun, 15 Feb 2009 22:41:58 +0100
User-agent: KMail/1.9.9

Hi,

KO Myung-Hun wrote:
> While I was compiling libcdio, I found 'HAVE_ICONV' not defined. And I
> knew that the problem was in 'working iconv' test against AIX 5.1.
> Would you mind explaining the reason of that codes ?

The code is pretty clear (taken from iconv.m4):

  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
     returns.  */
  {
    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
    if (cd_utf8_to_88591 != (iconv_t)(-1))
      {
        static const char input[] = "\342\202\254"; /* EURO SIGN */
        char buf[10];
        const char *inptr = input;
        size_t inbytesleft = strlen (input);
        char *outptr = buf;
        size_t outbytesleft = sizeof (buf);
        size_t res = iconv (cd_utf8_to_88591,
                            (char **) &inptr, &inbytesleft,
                            &outptr, &outbytesleft);
        if (res == 0)
          return 1;
      }
  }

The test tries to convert the EURO sign to ISO-8859-1 (which does not have an
EURO sign). If iconv() pretends it could do that, it is broken and unusable.

> It return '1' when the result of iconv() is '0'. BTW '1' means 'not
> working'. So test value should be '(size_t)(-1)' not '0'.

On systems that have a working iconv, the return value of above iconv()
call is either (size_t)(-1) or 1.

> Even though that code is specific to AIX 5.1, it should be tested only
> on AIX 5.1.

No, other versions like AIX 5.2, 5.3, 6.1 may have the same bug. Therefore
the test is not enclosed in any #ifdefs.

On which system did you observe that this test fails?

Bruno




reply via email to

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