]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/findutils-4.6.0-glibc2.28.patch
python3-msgpack: Fix build on i586
[people/pmueller/ipfire-2.x.git] / src / patches / findutils-4.6.0-glibc2.28.patch
1 Fix build failure on glibc-2.28:
2 fseeko.c: In function 'rpl_fseeko':
3 fseeko.c:110:4: error: #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
4 #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
5
6 Patch by milan hodoscek.
7
8 https://bugs.gentoo.org/663242
9 --- a/old/stdio-impl.h
10 +++ b/gl/lib/stdio-impl.h
11 @@ -1,5 +1,5 @@
12 /* Implementation details of FILE streams.
13 - Copyright (C) 2007-2008, 2010-2015 Free Software Foundation, Inc.
14 + Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc.
15
16 This program is free software: you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 @@ -12,12 +12,18 @@
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 - along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 + along with this program. If not, see <https://www.gnu.org/licenses/>. */
24
25 /* Many stdio implementations have the same logic and therefore can share
26 the same implementation of stdio extension API, except that some fields
27 have different naming conventions, or their access requires some casts. */
28
29 +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
30 + problem by defining it ourselves. FIXME: Do not rely on glibc
31 + internals. */
32 +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
33 +# define _IO_IN_BACKUP 0x100
34 +#endif
35
36 /* BSD stdio derived implementations. */
37
38 @@ -29,10 +35,10 @@
39 #include <errno.h> /* For detecting Plan9. */
40
41 #if defined __sferror || defined __DragonFly__ || defined __ANDROID__
42 - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
43 + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
44
45 # if defined __DragonFly__ /* DragonFly */
46 - /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
47 + /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/lib/libc/stdio/priv_stdio.h>. */
48 # define fp_ ((struct { struct __FILE_public pub; \
49 struct { unsigned char *_base; int _size; } _bf; \
50 void *cookie; \
51 @@ -49,30 +55,84 @@
52 fpos_t _offset; \
53 /* More fields, not relevant here. */ \
54 } *) fp)
55 - /* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
56 + /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/include/stdio.h>. */
57 # define _p pub._p
58 # define _flags pub._flags
59 # define _r pub._r
60 # define _w pub._w
61 +# elif defined __ANDROID__ /* Android */
62 + /* Up to this commit from 2015-10-12
63 + <https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
64 + the innards of FILE were public, and fp_ub could be defined like for OpenBSD,
65 + see <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/fileext.h>
66 + and <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/local.h>.
67 + After this commit, the innards of FILE are hidden. */
68 +# define fp_ ((struct { unsigned char *_p; \
69 + int _r; \
70 + int _w; \
71 + int _flags; \
72 + int _file; \
73 + struct { unsigned char *_base; size_t _size; } _bf; \
74 + int _lbfsize; \
75 + void *_cookie; \
76 + void *_close; \
77 + void *_read; \
78 + void *_seek; \
79 + void *_write; \
80 + struct { unsigned char *_base; size_t _size; } _ext; \
81 + unsigned char *_up; \
82 + int _ur; \
83 + unsigned char _ubuf[3]; \
84 + unsigned char _nbuf[1]; \
85 + struct { unsigned char *_base; size_t _size; } _lb; \
86 + int _blksize; \
87 + fpos_t _offset; \
88 + /* More fields, not relevant here. */ \
89 + } *) fp)
90 # else
91 # define fp_ fp
92 # endif
93
94 -# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Android */
95 +# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */
96 /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
97 - and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
98 + and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
99 + and <https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/lib/libc/stdio/fileext.h> */
100 struct __sfileext
101 {
102 struct __sbuf _ub; /* ungetc buffer */
103 /* More fields, not relevant here. */
104 };
105 # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
106 -# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */
107 +# elif defined __ANDROID__ /* Android */
108 + struct __sfileext
109 + {
110 + struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */
111 + /* More fields, not relevant here. */
112 + };
113 +# define fp_ub ((struct __sfileext *) fp_->_ext._base)->_ub
114 +# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */
115 # define fp_ub fp_->_ub
116 # endif
117
118 # define HASUB(fp) (fp_ub._base != NULL)
119
120 +# if defined __ANDROID__ /* Android */
121 + /* Needed after this commit from 2016-01-25
122 + <https://android.googlesource.com/platform/bionic.git/+/e70e0e9267d069bf56a5078c99307e08a7280de7> */
123 +# ifndef __SEOF
124 +# define __SLBF 1
125 +# define __SNBF 2
126 +# define __SRD 4
127 +# define __SWR 8
128 +# define __SRW 0x10
129 +# define __SEOF 0x20
130 +# define __SERR 0x40
131 +# endif
132 +# ifndef __SOFF
133 +# define __SOFF 0x1000
134 +# endif
135 +# endif
136 +
137 #endif
138
139
140 @@ -81,7 +141,7 @@
141 #ifdef __TANDEM /* NonStop Kernel */
142 # ifndef _IOERR
143 /* These values were determined by the program 'stdioext-flags' at
144 - <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */
145 + <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */
146 # define _IOERR 0x40
147 # define _IOREAD 0x80
148 # define _IOWRT 0x4
149 @@ -99,6 +159,8 @@
150 int _file; \
151 unsigned int _flag; \
152 } *) fp)
153 +# elif defined __VMS /* OpenVMS */
154 +# define fp_ ((struct _iobuf *) fp)
155 # else
156 # define fp_ fp
157 # endif
158 @@ -110,4 +172,31 @@
159 # define _flag __flag
160 # endif
161
162 +#elif defined _WIN32 && ! defined __CYGWIN__ /* newer Windows with MSVC */
163 +
164 +/* <stdio.h> does not define the innards of FILE any more. */
165 +# define WINDOWS_OPAQUE_FILE
166 +
167 +struct _gl_real_FILE
168 +{
169 + /* Note: Compared to older Windows and to mingw, it has the fields
170 + _base and _cnt swapped. */
171 + unsigned char *_ptr;
172 + unsigned char *_base;
173 + int _cnt;
174 + int _flag;
175 + int _file;
176 + int _charbuf;
177 + int _bufsiz;
178 +};
179 +# define fp_ ((struct _gl_real_FILE *) fp)
180 +
181 +/* These values were determined by a program similar to the one at
182 + <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */
183 +# define _IOREAD 0x1
184 +# define _IOWRT 0x2
185 +# define _IORW 0x4
186 +# define _IOEOF 0x8
187 +# define _IOERR 0x10
188 +
189 #endif
190 --- a/old/fseeko.c
191 +++ b/gl/lib/fseeko.c
192 @@ -1,5 +1,5 @@
193 /* An fseeko() function that, together with fflush(), is POSIX compliant.
194 - Copyright (C) 2007-2015 Free Software Foundation, Inc.
195 + Copyright (C) 2007-2018 Free Software Foundation, Inc.
196
197 This program is free software; you can redistribute it and/or modify
198 it under the terms of the GNU General Public License as published by
199 @@ -12,7 +12,7 @@
200 GNU General Public License for more details.
201
202 You should have received a copy of the GNU General Public License along
203 - with this program; if not, see <http://www.gnu.org/licenses/>. */
204 + with this program; if not, see <https://www.gnu.org/licenses/>. */
205
206 #include <config.h>
207
208 @@ -33,9 +33,9 @@ fseeko (FILE *fp, off_t offset, int whence)
209 #endif
210 #if _GL_WINDOWS_64_BIT_OFF_T
211 # undef fseeko
212 -# if HAVE__FSEEKI64 /* msvc, mingw64 */
213 +# if HAVE__FSEEKI64 && HAVE_DECL__FSEEKI64 /* msvc, mingw since msvcrt8.0, mingw64 */
214 # define fseeko _fseeki64
215 -# else /* mingw */
216 +# else /* mingw before msvcrt8.0 */
217 # define fseeko fseeko64
218 # endif
219 #endif
220 @@ -47,12 +47,13 @@ fseeko (FILE *fp, off_t offset, int whence)
221 #endif
222
223 /* These tests are based on fpurge.c. */
224 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
225 +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
226 + /* GNU libc, BeOS, Haiku, Linux libc5 */
227 if (fp->_IO_read_end == fp->_IO_read_ptr
228 && fp->_IO_write_ptr == fp->_IO_write_base
229 && fp->_IO_save_base == NULL)
230 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
231 - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
232 + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
233 # if defined __SL64 && defined __SCLE /* Cygwin */
234 if ((fp->_flags & __SL64) == 0)
235 {
236 @@ -80,7 +81,7 @@ fseeko (FILE *fp, off_t offset, int whence)
237 #elif defined __minix /* Minix */
238 if (fp_->_ptr == fp_->_buf
239 && (fp_->_ptr == NULL || fp_->_count == 0))
240 -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
241 +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */
242 if (fp_->_ptr == fp_->_base
243 && (fp_->_ptr == NULL || fp_->_cnt == 0))
244 #elif defined __UCLIBC__ /* uClibc */
245 @@ -117,18 +118,19 @@ fseeko (FILE *fp, off_t offset, int whence)
246 if (pos == -1)
247 {
248 #if defined __sferror || defined __DragonFly__ || defined __ANDROID__
249 - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
250 + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
251 fp_->_flags &= ~__SOFF;
252 #endif
253 return -1;
254 }
255
256 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
257 +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
258 + /* GNU libc, BeOS, Haiku, Linux libc5 */
259 fp->_flags &= ~_IO_EOF_SEEN;
260 fp->_offset = pos;
261 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
262 - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
263 -# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000)
264 + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
265 +# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix
266 /* fp_->_offset is typed as an integer. */
267 fp_->_offset = pos;
268 # else
269 @@ -150,8 +152,8 @@ fseeko (FILE *fp, off_t offset, int whence)
270 fp_->_flags &= ~__SEOF;
271 #elif defined __EMX__ /* emx+gcc */
272 fp->_flags &= ~_IOEOF;
273 -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
274 - fp->_flag &= ~_IOEOF;
275 +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */
276 + fp_->_flag &= ~_IOEOF;
277 #elif defined __MINT__ /* Atari FreeMiNT */
278 fp->__offset = pos;
279 fp->__eof = 0;
280 --- a/old/freadahead.c
281 +++ b/gl/lib/freadahead.c
282 @@ -1,5 +1,5 @@
283 /* Retrieve information about a FILE stream.
284 - Copyright (C) 2007-2015 Free Software Foundation, Inc.
285 + Copyright (C) 2007-2018 Free Software Foundation, Inc.
286
287 This program is free software: you can redistribute it and/or modify
288 it under the terms of the GNU General Public License as published by
289 @@ -12,7 +12,7 @@
290 GNU General Public License for more details.
291
292 You should have received a copy of the GNU General Public License
293 - along with this program. If not, see <http://www.gnu.org/licenses/>. */
294 + along with this program. If not, see <https://www.gnu.org/licenses/>. */
295
296 #include <config.h>
297
298 @@ -22,17 +22,26 @@
299 #include <stdlib.h>
300 #include "stdio-impl.h"
301
302 +#if defined __DragonFly__
303 +/* Defined in libc, but not declared in <stdio.h>. */
304 +extern size_t __sreadahead (FILE *);
305 +#endif
306 +
307 +/* This file is not used on systems that have the __freadahead function,
308 + namely musl libc. */
309 +
310 size_t
311 freadahead (FILE *fp)
312 {
313 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
314 +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
315 + /* GNU libc, BeOS, Haiku, Linux libc5 */
316 if (fp->_IO_write_ptr > fp->_IO_write_base)
317 return 0;
318 return (fp->_IO_read_end - fp->_IO_read_ptr)
319 + (fp->_flags & _IO_IN_BACKUP ? fp->_IO_save_end - fp->_IO_save_base :
320 0);
321 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
322 - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
323 + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
324 if ((fp_->_flags & __SWR) != 0 || fp_->_r < 0)
325 return 0;
326 # if defined __DragonFly__
327 @@ -53,7 +62,7 @@ freadahead (FILE *fp)
328 if ((fp_->_flags & _IOWRITING) != 0)
329 return 0;
330 return fp_->_count;
331 -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
332 +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */
333 if ((fp_->_flag & _IOWRT) != 0)
334 return 0;
335 return fp_->_cnt;