1From: Santiago Vila <sanvila@debian.org> 2Subject: Fix FTBFS with glibc 2.28 3Bug-Debian: https://bugs.debian.org/915152 4X-Debian-version: 1.4.18-2 5 6Based on this gnulib commit by Paul Eggert: 7 8https://lists.gnu.org/r/bug-gnulib/2018-03/msg00002.html 9 10--- a/lib/fflush.c 11+++ b/lib/fflush.c 12@@ -33,7 +33,7 @@ 13 #undef fflush 14 15 16-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 17+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 18 19 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ 20 static void 21@@ -72,7 +72,7 @@ 22 23 #endif 24 25-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) 26+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) 27 28 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT 29 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ 30@@ -148,7 +148,7 @@ 31 if (stream == NULL || ! freading (stream)) 32 return fflush (stream); 33 34-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 35+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 36 37 clear_ungetc_buffer_preserving_position (stream); 38 39--- a/lib/fpending.c 40+++ b/lib/fpending.c 41@@ -32,7 +32,7 @@ 42 /* Most systems provide FILE as a struct and the necessary bitmask in 43 <stdio.h>, because they need it for implementing getc() and putc() as 44 fast macros. */ 45-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 46+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 47 return fp->_IO_write_ptr - fp->_IO_write_base; 48 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 49 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ 50--- a/lib/fpurge.c 51+++ b/lib/fpurge.c 52@@ -62,7 +62,7 @@ 53 /* Most systems provide FILE as a struct and the necessary bitmask in 54 <stdio.h>, because they need it for implementing getc() and putc() as 55 fast macros. */ 56-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 57+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 58 fp->_IO_read_end = fp->_IO_read_ptr; 59 fp->_IO_write_ptr = fp->_IO_write_base; 60 /* Avoid memory leak when there is an active ungetc buffer. */ 61--- a/lib/freadahead.c 62+++ b/lib/freadahead.c 63@@ -25,7 +25,7 @@ 64 size_t 65 freadahead (FILE *fp) 66 { 67-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 68+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 69 if (fp->_IO_write_ptr > fp->_IO_write_base) 70 return 0; 71 return (fp->_IO_read_end - fp->_IO_read_ptr) 72--- a/lib/freading.c 73+++ b/lib/freading.c 74@@ -31,7 +31,7 @@ 75 /* Most systems provide FILE as a struct and the necessary bitmask in 76 <stdio.h>, because they need it for implementing getc() and putc() as 77 fast macros. */ 78-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 79+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 80 return ((fp->_flags & _IO_NO_WRITES) != 0 81 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 82 && fp->_IO_read_base != NULL)); 83--- a/lib/fseeko.c 84+++ b/lib/fseeko.c 85@@ -47,7 +47,7 @@ 86 #endif 87 88 /* These tests are based on fpurge.c. */ 89-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 90+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 91 if (fp->_IO_read_end == fp->_IO_read_ptr 92 && fp->_IO_write_ptr == fp->_IO_write_base 93 && fp->_IO_save_base == NULL) 94@@ -123,7 +123,7 @@ 95 return -1; 96 } 97 98-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 99+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ 100 fp->_flags &= ~_IO_EOF_SEEN; 101 fp->_offset = pos; 102 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 103--- a/lib/stdio-impl.h 104+++ b/lib/stdio-impl.h 105@@ -18,6 +18,12 @@ 106 the same implementation of stdio extension API, except that some fields 107 have different naming conventions, or their access requires some casts. */ 108 109+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this 110+ problem by defining it ourselves. FIXME: Do not rely on glibc 111+ internals. */ 112+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN 113+# define _IO_IN_BACKUP 0x100 114+#endif 115 116 /* BSD stdio derived implementations. */ 117 118