This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC] fmemopen posix compliance
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Wed, 11 Jun 2014 18:37:21 -0300
- Subject: [RFC] fmemopen posix compliance
- Authentication-results: sourceware.org; auth=none
Hi all,
It is known that GLIBC fmemopen differs from POSIX definition from some time,
in fact it predates POSIX standard. However, differences now has reached a
point that both differ in many points, leading to various bug reports:
fmemopen_seek() incorrectly inverses seek offset when using SEEK_END
https://sourceware.org/bugzilla/show_bug.cgi?id=14292
fmemopen does not honor append mode
https://sourceware.org/bugzilla/show_bug.cgi?id=13152
fmemopen streams fail to read eof
https://sourceware.org/bugzilla/show_bug.cgi?id=13151
fmemopen returns NULL when len=0
https://sourceware.org/bugzilla/show_bug.cgi?id=11216
fmemopen(buf,size,"w+b") isn't binary
https://sourceware.org/bugzilla/show_bug.cgi?id=12836
fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
https://sourceware.org/bugzilla/show_bug.cgi?id=6544
* From last POSIX definition, I say bz#11216 is not a GLIBC defect anymore and I
think it should be closed.
And currently I see there is no point of providing an unique implementation
now that POSIX has a working fmemopen definition. So I propose by placing current
implementation in a versioned symbol and adding a POSIX compliance one for
GLIBC 2.20 and forward.
Current fmemopen POSIX definition is:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html
The following two patches implements the new POSIX compliant fmemopen and adjust
the testcases.
Since it is RFC email, I haven't added CL to the patches neither update the documentation.
If we decide that using a POSIX compliant fmemopen is the way we want for GLIBC 2.20,
I will update the patch with the missing points.