Gentoo Archives: gentoo-commits

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