public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/29913] New: iconv(3) is not POSIX compliant, and does not conform to linux man-pages manual
@ 2022-12-16 23:03 steffen at sdaoden dot eu
  2023-02-18 20:48 ` [Bug libc/29913] " rrt at sc3d dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: steffen at sdaoden dot eu @ 2022-12-16 23:03 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29913

            Bug ID: 29913
           Summary: iconv(3) is not POSIX compliant, and does not conform
                    to linux man-pages manual
           Product: glibc
           Version: 2.36
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: steffen at sdaoden dot eu
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Disclaimer: i have reported this in the past but the issue was closed.

The problem is that without //TRANSLIT GNU iconv(3) fails to perform the

  If iconv( ) encounters a character in the input buffer that is valid, but for
which an identical character does not exist in the target codeset, iconv( )
shall perform an implementation-defined conversion on this character.

POSIX iconv(3) (Vol. 2: System Interfaces, Issue 7) requirement.
Instead GNU libc returns EILSEQ which is wrong as POSIX defined EILSEQ only for

  [EILSEQ] Input conversion stopped due to an input byte that does not belong
to the input codeset.

The Linux man-pages 6.01 manual (2022‐10‐09) says the same.  But GNU libc
_does_ fail for EILSEQ without //TRANSLIT even if the input is valid UTF-8.
As can be seen by running this (shortened variant of a config test program).
I say "Bye!" already here, and hope it gets fixed!

#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <iconv.h>
int main(void){
        char inb[16], oub[16], *inbp, *oubp;
        iconv_t id;
        size_t inl, oul;
        int rv;

        memcpy(inbp = inb, "\341\203\276", sizeof("\341\203\276"));
        inl = sizeof("\341\203\276") -1;
        oul = sizeof oub;
        oubp = oub;

        rv = 1;
        if((id = iconv_open("us-ascii"/*//TRANSLIT"*/, "utf-8")) ==
(iconv_t)-1)
                goto jleave;

        rv = 14;
        if(iconv(id, &inbp, &inl, &oubp, &oul) == (size_t)-1)
{
fprintf(stderr, "error %s %d==%d\n",strerror(errno),errno,errno==EILSEQ);
                goto jleave;
}

fprintf(stderr, "bummer\n");
jleave:
        if(id != (iconv_t)-1)
                iconv_close(id);

        return rv;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-02-20 21:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 23:03 [Bug libc/29913] New: iconv(3) is not POSIX compliant, and does not conform to linux man-pages manual steffen at sdaoden dot eu
2023-02-18 20:48 ` [Bug libc/29913] " rrt at sc3d dot org
2023-02-18 21:20 ` rrt at sc3d dot org
2023-02-18 22:43 ` steffen at sdaoden dot eu
2023-02-19  0:40 ` bruno at clisp dot org
2023-02-19  0:51 ` bruno at clisp dot org
2023-02-19  1:58 ` steffen at sdaoden dot eu
2023-02-19 10:06 ` rrt at sc3d dot org
2023-02-19 10:15 ` rrt at sc3d dot org
2023-02-19 10:22 ` rrt at sc3d dot org
2023-02-19 22:57 ` steffen at sdaoden dot eu
2023-02-19 23:02 ` steffen at sdaoden dot eu
2023-02-20 20:09 ` steffen at sdaoden dot eu
2023-02-20 20:54 ` steffen at sdaoden dot eu
2023-02-20 21:52 ` steffen at sdaoden dot eu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).