LWN: Comments on "GNU C Library 2.28 released" https://lwn.net/Articles/761462/ This is a special feed containing comments posted to the individual LWN article titled "GNU C Library 2.28 released". en-us Sat, 18 Oct 2025 16:59:15 +0000 Sat, 18 Oct 2025 16:59:15 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net GNU C Library 2.28 released https://lwn.net/Articles/761872/ https://lwn.net/Articles/761872/ zwol <div class="FormattedComment"> I haven't thought that possibility through in detail, but I believe it would just change the set of programs that break, and in some ways it would be worse, because macros can be #undef-ed, but file-scope symbols can't.<br> </div> Mon, 06 Aug 2018 14:54:15 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761805/ https://lwn.net/Articles/761805/ dezgeg <div class="FormattedComment"> Couldn't those symbols be changed from macros to inline functions instead?<br> </div> Sat, 04 Aug 2018 00:35:45 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761757/ https://lwn.net/Articles/761757/ zwol All of the stdio.h input functions besides fgetc are required to behave as-if they internally make a series of calls to fgetc (<a rel="nofollow" href="http://port70.net/~nsz/c/c11/n1570.html#7.21.3p11">7.21.3p11</a>), so a sticky-EOF requirement for fgetc inherits to all of the other functions. <p>The wording for fgetc _was_ ambiguous in C89, but it was changed in C99, and if you dig up the defect report (I don't remember the number off the top of my head) it's very clear that the committee meant to make EOF a sticky condition. It has always been sticky in the BSD lineage; glibc actually had a note in the code saying "we deviate from the standard for SysV compatibility" but nowadays we think BSD compatibility is more important. Fri, 03 Aug 2018 14:20:02 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761756/ https://lwn.net/Articles/761756/ zwol <div class="FormattedComment"> Yeah, nobody was super happy about breaking compatibility with *BSD in this way, but it wasn't simply a 'theoretical namespace purity' problem. Perfectly ordinary-looking C++ programs like this<br> <p> #include &lt;iostream&gt;<br> class Foo {<br> int major;<br> public:<br> Foo(int maj) : major(maj) {}<br> // ...<br> };<br> <p> would fail to compile on (GNU/)Linux with apparently nonsensical error messages:<br> <p> test.cc: In constructor ‘Foo::Foo(int)’:<br> test.cc:6:18: error: class ‘Foo’ does not have any field named ‘gnu_dev_major’<br> <p> because, you see, libstdc++'s headers define _GNU_SOURCE for you, and many of them also include &lt;stdlib.h&gt;, and when _GNU_SOURCE is on, glibc's &lt;stdlib.h&gt; includes &lt;sys/types.h&gt;.<br> <p> There isn't any particularly good reason for &lt;stdlib.h&gt; to include &lt;sys/types.h&gt; under _GNU_SOURCE, but taking it out broke hundreds of programs in test rebuilds of Debian and Fedora. libstdc++ defining _GNU_SOURCE is agreed to be a bug, but fixing it is really hard, due to the sheer variety of things the C++ library is required to do from inline code in its headers, some of which can't be accomplished using only the facilities of ISO C, or even ISO C + POSIX.1-2008.<br> <p> So we decided that breaking the smaller number of programs that actually _need_ the major/minor/mkdev macros was the least bad option.<br> </div> Fri, 03 Aug 2018 14:11:45 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761719/ https://lwn.net/Articles/761719/ pm215 <div class="FormattedComment"> On the other hand, these macros have lived in sys/types.h forever right back to 2.9BSD. I think it's a mistake that glibc has broken source compatibility and forced everybody else to gratuitously update their code (which was following the documentation for which header to use for them), including possibly now having to have configure machinery for checking "are we running with a glibc that's done something incompatible with the rest of the world", purely to fix a theoretical namespace purity issue.<br> <p> </div> Fri, 03 Aug 2018 09:33:57 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761704/ https://lwn.net/Articles/761704/ dirtyepic <div class="FormattedComment"> To be fair though, if I were an upstream and my package worked fine everywhere except on Gentoo's "non-standard" glibc, I might also be a bit skeptical, or at the very least it would be pretty low on my list of priorities until it actually became a problem.<br> <p> IIRC the reason for backporting the types.h change was to provide glibc upstream with some data on how much real world code would break. In that it succeeded. What I find disappointing is the duplication of effort as every distro pulls in the new version and starts the tedious process of rebuilding their repos and patching failing packages. All that work has already been done and has been for a while. It would have been nice to have had it all fixed upstream and save everyone some time.<br> </div> Fri, 03 Aug 2018 05:12:01 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761696/ https://lwn.net/Articles/761696/ flussence <div class="FormattedComment"> That's exactly what prompted my comment. I was trying to write an ebuild for some random github project that insisted on using a customised/bundled copy of Python 2, and couldn't convince them that all those things are bad ideas in isolation, let alone together as they were.<br> <p> They've had half a year and done nothing about it, the technical debt collector is about to come knocking.<br> </div> Thu, 02 Aug 2018 23:02:01 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761681/ https://lwn.net/Articles/761681/ eru <div class="FormattedComment"> fgets() is one of the interfaces that should not be there. It looks simple enough (therefore beginners often write line by line readers with it), but using it in a truly robust way is tricky.<br> </div> Thu, 02 Aug 2018 20:31:33 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761577/ https://lwn.net/Articles/761577/ Lekensteyn <blockquote> * All stdio functions now treat end-of-file as a sticky condition. If you read from a file until EOF, and then the file is enlarged by another process, you must call clearerr or another function with the same effect (e.g. fseek, rewind) before you can read the additional data. This corrects a longstanding C99 conformance bug. It is most likely to affect programs that use stdio to read interactive input from a terminal. (<a href="https://sourceware.org/bugzilla/show_bug.cgi?id=1190">Bug #1190</a>.) </blockquote> Sigh, I know of at least one application that will break, it assumed that reading after EOF is possible if new data was appended later on. C99 about fgetc: <blockquote>If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-of-file indicator for the stream is set and the fgetc function returns EOF. </blockquote> C99 about fgets: <blockquote>No additional characters are read after a new-line character (which is retained) or after end-of-file.</blockquote> This is a bit ambiguous, possible interpretations for when to stop reading (assuming no new-line characters): <ol> <li> if the stream is at the end-of-file (previous behavior, reasonable). <li> if the end-of-file indicator for the stream is set (new behavior). </ol> <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/fgets.html">POSIX fgets</a> says: <blockquote>Upon successful completion, fgets() shall return s. If the stream is at end-of-file, the end-of-file indicator for the stream shall be set and fgets() shall return a null pointer.</blockquote> Arguably the new glibc behavior is also non-compliant. "Upon successful completion" does not suggest that previous error conditions should be sticky. Thu, 02 Aug 2018 10:39:28 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761551/ https://lwn.net/Articles/761551/ dirtyepic <div class="FormattedComment"> It's unfortunate that many of those patches were ignored or rejected by projects when they tried to upstream them. Maybe next time.<br> </div> Thu, 02 Aug 2018 02:39:07 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761545/ https://lwn.net/Articles/761545/ flussence <div class="FormattedComment"> The sysmacros.h change is going to bite quite a few people; Gentoo has been shipping it with that patch for a year or two and a lot of downstream code also needed patching, one of the notable ones being Python 2.<br> </div> Thu, 02 Aug 2018 00:30:27 +0000 GNU C Library 2.28 released https://lwn.net/Articles/761497/ https://lwn.net/Articles/761497/ welinder <div class="FormattedComment"> Note #22644 which is really understated. A somewhat more blunt description would be<br> <p> "Running 32-bit x86 code with pre-2.28 libc will suffer from seemingly random memory<br> corruption."<br> <p> It's particularly easily to hit with std::vector.<br> </div> Wed, 01 Aug 2018 15:54:03 +0000