diff -r -U3 coreutils-8.5/lib/freadahead.c coreutils-8.5-patched/lib/freadahead.c
--- coreutils-8.5/lib/freadahead.c	2010-04-23 07:44:00.000000000 -0600
+++ coreutils-8.5-patched/lib/freadahead.c	2019-08-01 18:35:31.580843463 -0600
@@ -25,7 +25,7 @@
 size_t
 freadahead (FILE *fp)
 {
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   if (fp->_IO_write_ptr > fp->_IO_write_base)
     return 0;
   return (fp->_IO_read_end - fp->_IO_read_ptr)
diff -r -U3 coreutils-8.5/lib/freadptr.c coreutils-8.5-patched/lib/freadptr.c
--- coreutils-8.5/lib/freadptr.c	2010-04-23 07:44:00.000000000 -0600
+++ coreutils-8.5-patched/lib/freadptr.c	2019-08-01 18:35:31.580843463 -0600
@@ -29,7 +29,7 @@
   size_t size;

   /* Keep this code in sync with freadahead!  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   if (fp->_IO_write_ptr > fp->_IO_write_base)
     return NULL;
   size = fp->_IO_read_end - fp->_IO_read_ptr;
diff -r -U3 coreutils-8.5/lib/freadseek.c coreutils-8.5-patched/lib/freadseek.c
--- coreutils-8.5/lib/freadseek.c	2010-04-23 07:44:00.000000000 -0600
+++ coreutils-8.5-patched/lib/freadseek.c	2019-08-01 18:35:31.580843463 -0600
@@ -34,7 +34,7 @@
 freadptrinc (FILE *fp, size_t increment)
 {
   /* Keep this code in sync with freadptr!  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   fp->_IO_read_ptr += increment;
 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
   fp_->_p += increment;
diff -r -U3 coreutils-8.5/lib/fseeko.c coreutils-8.5-patched/lib/fseeko.c
--- coreutils-8.5/lib/fseeko.c	2010-04-21 12:11:48.000000000 -0600
+++ coreutils-8.5-patched/lib/fseeko.c	2019-08-01 18:35:31.580843463 -0600
@@ -42,7 +42,7 @@
 #endif

   /* These tests are based on fpurge.c.  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   if (fp->_IO_read_end == fp->_IO_read_ptr
       && fp->_IO_write_ptr == fp->_IO_write_base
       && fp->_IO_save_base == NULL)
diff -r -U3 coreutils-8.5/lib/fseterr.c coreutils-8.5-patched/lib/fseterr.c
--- coreutils-8.5/lib/fseterr.c	2010-04-23 07:44:00.000000000 -0600
+++ coreutils-8.5-patched/lib/fseterr.c	2019-08-01 18:35:31.584843515 -0600
@@ -29,7 +29,7 @@
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, because they need it for implementing getc() and putc() as
      fast macros.  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   fp->_flags |= _IO_ERR_SEEN;
 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
   fp_->_flags |= __SERR;
diff -r -U3 coreutils-8.5/lib/stdio-impl.h coreutils-8.5-patched/lib/stdio-impl.h
--- coreutils-8.5/lib/stdio-impl.h	2010-04-23 07:44:01.000000000 -0600
+++ coreutils-8.5-patched/lib/stdio-impl.h	2019-08-01 18:35:31.584843515 -0600
@@ -18,6 +18,12 @@
    the same implementation of stdio extension API, except that some fields
    have different naming conventions, or their access requires some casts.  */

+/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
+ *    problem by defining it ourselves.  FIXME: Do not rely on glibc
+ *       internals.  */
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
+# define _IO_IN_BACKUP 0x100
+#endif

 /* BSD stdio derived implementations.  */

diff -r -U3 coreutils-8.5/lib/stdio.in.h coreutils-8.5-patched/lib/stdio.in.h
--- coreutils-8.5/lib/stdio.in.h	2010-04-21 12:11:57.000000000 -0600
+++ coreutils-8.5-patched/lib/stdio.in.h	2019-08-01 18:26:34.113941755 -0600
@@ -139,7 +139,7 @@
    so any use of gets warrants an unconditional warning.  Assume it is
    always declared, since it is required by C89.  */
 #undef gets
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/

 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
