[Bug 196540] iconv() function violates POSIX

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Jan 6 13:04:42 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196540

            Bug ID: 196540
           Summary: iconv() function violates POSIX
           Product: Base System
           Version: 10.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: standards
          Assignee: freebsd-standards at FreeBSD.org
          Reporter: quintus at quintilianus.eu

Hi everyone,

POSIX.1-2008 mandates the function declaration of the iconv() function to look
like this:

size_t iconv(iconv_t cd, char **restrict inbuf,
       size_t *restrict inbytesleft, char **restrict outbuf,
       size_t *restrict outbytesleft);

(see http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html ).

However, the actual function declared in /usr/include/iconv.h is declared as
follows:

size_t iconv(iconv_t, const char ** __restrict,
             size_t * __restrict, char ** __restrict,
             size_t * __restrict);

Notice the `const` qualifier in the declaration of the second parameter, which
shouldn’t be there as per POSIX. This causes programs using the iconv()
function as per POSIX (without the `const` qualifier) to fail compilation.

Even worse, the documentation of iconv() in form of the iconv(3) manpage also
contains the POSIX declaration, which is in conflict with the actual
declaration in the header file. That is, the documentation is correct, but
declaration in the header file differs from the manpage.

Output of $ uname -a in case it’s required:

  $ uname -a
  FreeBSD bsdtest.quintilianus.eu 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401:
Tue Nov 11 21:02:49 UTC 2014
root at releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64

Greetings,
Marvin

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-standards mailing list