* updated ktuberling (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / base / findutils / gnulib.patch
blob999b54ca8b1fbaf392b86d4e90eb4b54d4ba6694
1 From 4af4a4a71827c0bc5e0ec67af23edef4f15cee8e Mon Sep 17 00:00:00 2001
2 From: Paul Eggert <eggert@cs.ucla.edu>
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=utf8
7 Content-Transfer-Encoding: 8bit
9 Problem reported by Daniel P. Berrangé in:
10 https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
11 * lib/fflush.c (clear_ungetc_buffer_preserving_position)
12 (disable_seek_optimization, rpl_fflush):
13 * lib/fpurge.c (fpurge):
14 * lib/freadahead.c (freadahead):
15 * lib/freading.c (freading):
16 * lib/fseeko.c (fseeko):
17 Check _IO_EOF_SEEN instead of _IO_ftrylockfile.
18 * lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]:
19 Define if not already defined.
20 ---
21 ChangeLog | 23 +++++++++++++++++++++++
22 lib/fflush.c | 6 +++---
23 lib/fpurge.c | 2 +-
24 lib/freadahead.c | 2 +-
25 lib/freading.c | 2 +-
26 lib/fseeko.c | 4 ++--
27 lib/fwritable.c | 2 +-
28 lib/fwriting.c | 2 +-
29 lib/stdio-impl.h | 6 ++++++
30 15 files changed, 45 insertions(+), 16 deletions(-)
32 index 983ade0..a6edfa1 100644
33 --- a/gl/lib/fflush.c
34 +++ b/gl/lib/fflush.c
35 @@ -33,7 +33,7 @@
36 #undef fflush
39 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
40 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
42 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
43 static void
44 @@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
46 #endif
48 -#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
49 +#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
51 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
52 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
53 @@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
54 if (stream == NULL || ! freading (stream))
55 return fflush (stream);
57 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
58 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
60 clear_ungetc_buffer_preserving_position (stream);
62 diff --git a/lib/fpurge.c b/lib/fpurge.c
63 index b1d417c..3aedcc3 100644
64 --- a/gl/lib/fpurge.c
65 +++ b/gl/lib/fpurge.c
66 @@ -62,7 +62,7 @@ fpurge (FILE *fp)
67 /* Most systems provide FILE as a struct and the necessary bitmask in
68 <stdio.h>, because they need it for implementing getc() and putc() as
69 fast macros. */
70 -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
71 +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
72 fp->_IO_read_end = fp->_IO_read_ptr;
73 fp->_IO_write_ptr = fp->_IO_write_base;
74 /* Avoid memory leak when there is an active ungetc buffer. */
75 diff --git a/lib/freadahead.c b/lib/freadahead.c
76 index c2ecb5b..23ec76e 100644
77 --- a/gl/lib/freadahead.c
78 +++ b/gl/lib/freadahead.c
79 @@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *);
80 size_t
81 freadahead (FILE *fp)
83 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
84 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
85 if (fp->_IO_write_ptr > fp->_IO_write_base)
86 return 0;
87 return (fp->_IO_read_end - fp->_IO_read_ptr)
88 diff --git a/lib/freading.c b/lib/freading.c
89 index 73c28ac..c24d0c8 100644
90 --- a/gl/lib/freading.c
91 +++ b/gl/lib/freading.c
92 @@ -31,7 +31,7 @@ freading (FILE *fp)
93 /* Most systems provide FILE as a struct and the necessary bitmask in
94 <stdio.h>, because they need it for implementing getc() and putc() as
95 fast macros. */
96 -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
97 +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
98 return ((fp->_flags & _IO_NO_WRITES) != 0
99 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
100 && fp->_IO_read_base != NULL));
101 index 0101ab5..193f4e8 100644
102 --- a/gl/lib/fseeko.c
103 +++ b/gl/lib/fseeko.c
104 @@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
105 #endif
107 /* These tests are based on fpurge.c. */
108 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
109 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
110 if (fp->_IO_read_end == fp->_IO_read_ptr
111 && fp->_IO_write_ptr == fp->_IO_write_base
112 && fp->_IO_save_base == NULL)
113 @@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
114 return -1;
117 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
118 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
119 fp->_flags &= ~_IO_EOF_SEEN;
120 fp->_offset = pos;
121 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
122 index 461ab0f..4a3d9c8 100644
123 --- a/gl/lib/stdio-impl.h
124 +++ b/gl/lib/stdio-impl.h
125 @@ -18,6 +18,12 @@
126 the same implementation of stdio extension API, except that some fields
127 have different naming conventions, or their access requires some casts. */
129 +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
130 + problem by defining it ourselves. FIXME: Do not rely on glibc
131 + internals. */
132 +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
133 +# define _IO_IN_BACKUP 0x100
134 +#endif
136 /* BSD stdio derived implementations. */
139 1.9.1
141 --- findutils-4.6.0/gl/lib/mountlist.c.vanilla 2018-08-03 19:48:05.362247358 +0000
142 +++ findutils-4.6.0/gl/lib/mountlist.c 2018-08-03 19:49:28.042246115 +0000
143 @@ -37,6 +37,8 @@
144 # include <sys/param.h>
145 #endif
147 +#include <sys/sysmacros.h>
149 #if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */
150 # if HAVE_SYS_UCRED_H
151 # include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,