Both Linux and the GNU userspace (glibc) seem to have a number of "WONTFIX" bugs, i.e. bugs which the responsible parties have declared their unwillingness to fix despite clearly violating the requirements of ISO C and/or POSIX, but I'm unaware of any resource for programmers which lists such bugs and suggestions for working around them.
Here are a few that come to mind:
- The Linux UDP
select
bug:select
(and related interfaces) flag a UDP socket file descriptor ready for reading as soon as a packet has been received, without confirming the checksum. On subsequentrecv
/read
/etc., if the checksum was invalid, the call will block. Working around this requires always setting UDP sockets to non-blocking mode and dealing with theEWOULDBLOCK
condition. If I remember correctly, MaraDNS was the first notable project affected by this bug and the first to complain (unsuccessfully) to have it fixed. Note: As pointed out by Martin v. Löwis, apparently this bug has since been fixed. Workarounds are probably only necessary if you need to support really outdated versions of Linux. - The
printf
family in the GNU C library wrongly treats arguments to%s
as multibyte character strings instead of byte strings when a field precision (as in%.3s
) is specified, potentially causing truncated output. I know of no workaround except replacing the wholeprintf
subsystem (or simply not using theprintf
family of functions with non-multibyte-character byte strings, but this can be problematic if you want to process legacy-codepage strings usingsnprintf
while in a UTF-8 locale). Wrong(I cannot find the references for this and perhaps I am mistaken. The closest I can find is the issue oferrno
result codes for certain syscalls (can't remember which ones right off). Usually these are easy enough to check for if you just read the GNU/Linux man pages and compare them to the standard.ENOTSUP
andEOPNOTSUP
having the same value; see PDTR 24715.
What are some more bugs and workarounds we can add to this list? My goals in asking this question are:
- To build a more complete list of such bugs so that both new and experienced programmers can quickly become aware of potential issues that could arise when running an intended-to-be-portable program on GNU/Linux.
- To leverage the SO collective brain to think up clever and unobtrusive standard workarounds for as many such bugs as possible, instead of everyone having to invent their own workarounds after getting stung, and possibly doing so in suboptimal, ugly, or hackish ways - or worse yet, in ways that break support for more-conformant systems.