Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Jan 2015 13:04:42 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-standards@FreeBSD.org
Subject:   [Bug 196540] iconv() function violates POSIX
Message-ID:  <bug-196540-15@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D196540

            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@FreeBSD.org
          Reporter: quintus@quintilianus.eu

Hi everyone,

POSIX.1-2008 mandates the function declaration of the iconv() function to l=
ook
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, wh=
ich
shouldn=E2=80=99t be there as per POSIX. This causes programs using the ico=
nv()
function as per POSIX (without the `const` qualifier) to fail compilation.

Even worse, the documentation of iconv() in form of the iconv(3) manpage al=
so
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=E2=80=99s required:

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

Greetings,
Marvin

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-196540-15>