gnulib.patch 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. From 1831628c0630ae96a43586b2a25ca51cbdba3e53 Mon Sep 17 00:00:00 2001
  2. From: Paul Eggert <address@hidden>
  3. Date: Mon, 5 Mar 2018 10:56:29 -0800
  4. Subject: [PATCH] fflush: adjust to glibc 2.28 libio.h removal
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Problem reported by Daniel P. Berrangé in:
  9. https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
  10. * lib/fbufmode.c (fbufmode):
  11. * lib/fflush.c (clear_ungetc_buffer_preserving_position)
  12. (disable_seek_optimization, rpl_fflush):
  13. * lib/fpending.c (__fpending):
  14. * lib/fpurge.c (fpurge):
  15. * lib/freadable.c (freadable):
  16. * lib/freadahead.c (freadahead):
  17. * lib/freading.c (freading):
  18. * lib/freadptr.c (freadptr):
  19. * lib/freadseek.c (freadptrinc):
  20. * lib/fseeko.c (fseeko):
  21. * lib/fseterr.c (fseterr):
  22. * lib/fwritable.c (fwritable):
  23. * lib/fwriting.c (fwriting):
  24. Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
  25. * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
  26. Define if not already defined.
  27. ---
  28. Upstream-Status: Pending
  29. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  30. ChangeLog | 23 +++++++++++++++++++++++
  31. lib/fbufmode.c | 2 +-
  32. lib/fflush.c | 6 +++---
  33. lib/fpending.c | 2 +-
  34. lib/fpurge.c | 2 +-
  35. lib/freadable.c | 2 +-
  36. lib/freadahead.c | 2 +-
  37. lib/freading.c | 2 +-
  38. lib/freadptr.c | 2 +-
  39. lib/freadseek.c | 2 +-
  40. lib/fseeko.c | 4 ++--
  41. lib/fseterr.c | 2 +-
  42. lib/fwritable.c | 2 +-
  43. lib/fwriting.c | 2 +-
  44. lib/stdio-impl.h | 6 ++++++
  45. 15 files changed, 45 insertions(+), 16 deletions(-)
  46. Index: gzip-1.9/ChangeLog
  47. ===================================================================
  48. --- gzip-1.9.orig/ChangeLog
  49. +++ gzip-1.9/ChangeLog
  50. @@ -1,3 +1,26 @@
  51. +2018-03-05 Paul Eggert <address@hidden>
  52. +
  53. + fflush: adjust to glibc 2.28 libio.h removal
  54. + Problem reported by Daniel P. Berrangé in:
  55. + https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
  56. + * lib/fbufmode.c (fbufmode):
  57. + * lib/fflush.c (clear_ungetc_buffer_preserving_position)
  58. + (disable_seek_optimization, rpl_fflush):
  59. + * lib/fpending.c (__fpending):
  60. + * lib/fpurge.c (fpurge):
  61. + * lib/freadable.c (freadable):
  62. + * lib/freadahead.c (freadahead):
  63. + * lib/freading.c (freading):
  64. + * lib/freadptr.c (freadptr):
  65. + * lib/freadseek.c (freadptrinc):
  66. + * lib/fseeko.c (fseeko):
  67. + * lib/fseterr.c (fseterr):
  68. + * lib/fwritable.c (fwritable):
  69. + * lib/fwriting.c (fwriting):
  70. + Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
  71. + * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
  72. + Define if not already defined.
  73. +
  74. 2018-01-07 Jim Meyering <meyering@fb.com>
  75. version 1.9
  76. Index: gzip-1.9/lib/fflush.c
  77. ===================================================================
  78. --- gzip-1.9.orig/lib/fflush.c
  79. +++ gzip-1.9/lib/fflush.c
  80. @@ -33,7 +33,7 @@
  81. #undef fflush
  82. -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  83. +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  84. /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
  85. static void
  86. @@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
  87. #endif
  88. -#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
  89. +#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
  90. # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
  91. /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
  92. @@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
  93. if (stream == NULL || ! freading (stream))
  94. return fflush (stream);
  95. -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  96. +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  97. clear_ungetc_buffer_preserving_position (stream);
  98. Index: gzip-1.9/lib/fpurge.c
  99. ===================================================================
  100. --- gzip-1.9.orig/lib/fpurge.c
  101. +++ gzip-1.9/lib/fpurge.c
  102. @@ -62,7 +62,7 @@ fpurge (FILE *fp)
  103. /* Most systems provide FILE as a struct and the necessary bitmask in
  104. <stdio.h>, because they need it for implementing getc() and putc() as
  105. fast macros. */
  106. -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  107. +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  108. fp->_IO_read_end = fp->_IO_read_ptr;
  109. fp->_IO_write_ptr = fp->_IO_write_base;
  110. /* Avoid memory leak when there is an active ungetc buffer. */
  111. Index: gzip-1.9/lib/freading.c
  112. ===================================================================
  113. --- gzip-1.9.orig/lib/freading.c
  114. +++ gzip-1.9/lib/freading.c
  115. @@ -31,7 +31,7 @@ freading (FILE *fp)
  116. /* Most systems provide FILE as a struct and the necessary bitmask in
  117. <stdio.h>, because they need it for implementing getc() and putc() as
  118. fast macros. */
  119. -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  120. +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  121. return ((fp->_flags & _IO_NO_WRITES) != 0
  122. || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
  123. && fp->_IO_read_base != NULL));
  124. Index: gzip-1.9/lib/fseeko.c
  125. ===================================================================
  126. --- gzip-1.9.orig/lib/fseeko.c
  127. +++ gzip-1.9/lib/fseeko.c
  128. @@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when
  129. #endif
  130. /* These tests are based on fpurge.c. */
  131. -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  132. +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  133. if (fp->_IO_read_end == fp->_IO_read_ptr
  134. && fp->_IO_write_ptr == fp->_IO_write_base
  135. && fp->_IO_save_base == NULL)
  136. @@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when
  137. return -1;
  138. }
  139. -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  140. +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  141. fp->_flags &= ~_IO_EOF_SEEN;
  142. fp->_offset = pos;
  143. #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
  144. Index: gzip-1.9/lib/fseterr.c
  145. ===================================================================
  146. --- gzip-1.9.orig/lib/fseterr.c
  147. +++ gzip-1.9/lib/fseterr.c
  148. @@ -29,7 +29,7 @@ fseterr (FILE *fp)
  149. /* Most systems provide FILE as a struct and the necessary bitmask in
  150. <stdio.h>, because they need it for implementing getc() and putc() as
  151. fast macros. */
  152. -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  153. +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
  154. fp->_flags |= _IO_ERR_SEEN;
  155. #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
  156. /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
  157. Index: gzip-1.9/lib/stdio-impl.h
  158. ===================================================================
  159. --- gzip-1.9.orig/lib/stdio-impl.h
  160. +++ gzip-1.9/lib/stdio-impl.h
  161. @@ -18,6 +18,12 @@
  162. the same implementation of stdio extension API, except that some fields
  163. have different naming conventions, or their access requires some casts. */
  164. +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
  165. + problem by defining it ourselves. FIXME: Do not rely on glibc
  166. + internals. */
  167. +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
  168. +# define _IO_IN_BACKUP 0x100
  169. +#endif
  170. /* BSD stdio derived implementations. */