This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] fmemopen posix compliance


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]