Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/toolchain/glibc-patches:master commit in: 9999/
Date: Sun, 01 Jan 2023 18:42:38
Message-Id: 1672597779.82af9273c46fe3f6227d0bf0e9198a11f8a82156.dilfridge@gentoo
1 commit: 82af9273c46fe3f6227d0bf0e9198a11f8a82156
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 1 18:29:39 2023 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 1 18:29:39 2023 +0000
6 URL: https://gitweb.gentoo.org/proj/toolchain/glibc-patches.git/commit/?id=82af9273
7
8 Update dirent-related patchset from azanella/bz23960-dirent git branch
9
10 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
11
12 9999/0001-Disable-ldconfig-during-install.patch | 10 +-
13 ...Adapt-to-Gentoo-specific-etc-mail-aliases.patch | 7 +-
14 ...O0-in-conform-tests-to-survive-CC-changes.patch | 6 +-
15 .../0004-Fix-miscompilation-on-ia64-s-gcc-10.patch | 6 +-
16 ...t-skip-entries-with-zero-d_ino-values-BZ-.patch | 182 ---------------------
17 ...-linux-Use-getdents64-on-non-LFS-readdir.patch} | 61 ++++---
18 ...ternal-DIR-filepos-as-off64_t-BZ-23960-B.patch} | 10 +-
19 ...h => 0007-linux-Add-__readdir64_unlocked.patch} | 17 +-
20 ... 0008-linux-Add-__old_readdir64_unlocked.patch} | 34 ++--
21 ...tdents64-on-readdir64-compat-implementat.patch} | 95 ++++-------
22 ...h => 0010-dirent-Deprecate-getdirentries.patch} | 29 ++--
23 11 files changed, 126 insertions(+), 331 deletions(-)
24
25 diff --git a/9999/0001-Disable-ldconfig-during-install.patch b/9999/0001-Disable-ldconfig-during-install.patch
26 index 7bc6628..4a8c771 100644
27 --- a/9999/0001-Disable-ldconfig-during-install.patch
28 +++ b/9999/0001-Disable-ldconfig-during-install.patch
29 @@ -1,7 +1,10 @@
30 -From 4917be423cb1a70a66e90e39a73e986b011d7687 Mon Sep 17 00:00:00 2001
31 +From 5349895a928bff28939b228824c8265d20d9fa60 Mon Sep 17 00:00:00 2001
32 From: Mike Frysinger <vapier@g.o>
33 Date: Tue, 3 Aug 2021 00:34:59 +0200
34 -Subject: [PATCH 01/12] Disable ldconfig during install
35 +Subject: [PATCH 01/10] Disable ldconfig during install
36 +MIME-Version: 1.0
37 +Content-Type: text/plain; charset=UTF-8
38 +Content-Transfer-Encoding: 8bit
39
40 Do not bother running ldconfig on DESTDIR. It's a waste of time as we
41 won't use the result (portage will rebuild the cache after install).
42 @@ -10,6 +13,7 @@ we end up (incorrectly) flagging it as a violation as a write to /etc.
43
44 http://sourceware.org/ml/libc-alpha/2012-08/msg00118.html
45 https://bugs.gentoo.org/431038
46 +Signed-off-by: Andreas K. Hüttel <dilfridge@g.o>
47 ---
48 Makefile | 1 +
49 1 file changed, 1 insertion(+)
50 @@ -27,5 +31,5 @@ index 179dd478ff..763d6a084a 100644
51 $(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
52 $(slibdir) $(libdir)
53 --
54 -2.35.1
55 +2.38.2
56
57
58 diff --git a/9999/0002-Adapt-to-Gentoo-specific-etc-mail-aliases.patch b/9999/0002-Adapt-to-Gentoo-specific-etc-mail-aliases.patch
59 index 56b9db3..559e736 100644
60 --- a/9999/0002-Adapt-to-Gentoo-specific-etc-mail-aliases.patch
61 +++ b/9999/0002-Adapt-to-Gentoo-specific-etc-mail-aliases.patch
62 @@ -1,7 +1,7 @@
63 -From a66ccda34dd319ce19255a029b746362d5773d31 Mon Sep 17 00:00:00 2001
64 +From ab1ca71990a972e375709711f5fa268010505324 Mon Sep 17 00:00:00 2001
65 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@g.o>
66 Date: Mon, 22 Oct 2018 22:34:13 +0200
67 -Subject: [PATCH 02/12] Adapt to Gentoo-specific /etc/mail/aliases
68 +Subject: [PATCH 02/10] Adapt to Gentoo-specific /etc/mail/aliases
69 MIME-Version: 1.0
70 Content-Type: text/plain; charset=UTF-8
71 Content-Transfer-Encoding: 8bit
72 @@ -10,6 +10,7 @@ Patch by pacho2
73
74 Signed-off-by: Andreas K. Hüttel <dilfridge@g.o>
75 (cherry picked from commit 4e616cda056f471b799beba2b1cedc787ad4ecc0)
76 +Signed-off-by: Andreas K. Hüttel <dilfridge@g.o>
77 ---
78 nss/nss_files/files-alias.c | 2 +-
79 nss/tst-nss-files-alias-leak.c | 18 +++++++++---------
80 @@ -104,5 +105,5 @@ index 4bf6fe0834..1548eba2ad 100644
81 /* valgrind needs a temporary directory in the chroot. */
82 {
83 --
84 -2.35.1
85 +2.38.2
86
87
88 diff --git a/9999/0003-Force-O0-in-conform-tests-to-survive-CC-changes.patch b/9999/0003-Force-O0-in-conform-tests-to-survive-CC-changes.patch
89 index 95fc2c5..f662cda 100644
90 --- a/9999/0003-Force-O0-in-conform-tests-to-survive-CC-changes.patch
91 +++ b/9999/0003-Force-O0-in-conform-tests-to-survive-CC-changes.patch
92 @@ -1,7 +1,7 @@
93 -From 68476d32783ea64c21bbd6d166a69fa881a3f22b Mon Sep 17 00:00:00 2001
94 +From f44c6c3768c2a3ef274782a2e308fb6b8fe84499 Mon Sep 17 00:00:00 2001
95 From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@g.o>
96 Date: Fri, 14 Dec 2018 20:43:04 +0100
97 -Subject: [PATCH 03/12] Force -O0 in conform tests to survive $CC changes
98 +Subject: [PATCH 03/10] Force -O0 in conform tests to survive $CC changes
99 MIME-Version: 1.0
100 Content-Type: text/plain; charset=UTF-8
101 Content-Transfer-Encoding: 8bit
102 @@ -61,5 +61,5 @@ index f7fe3a7a0a..ad87fd2a6d 100644
103 args.header)
104 with tempfile.TemporaryDirectory() as temp_dir:
105 --
106 -2.35.1
107 +2.38.2
108
109
110 diff --git a/9999/0004-Fix-miscompilation-on-ia64-s-gcc-10.patch b/9999/0004-Fix-miscompilation-on-ia64-s-gcc-10.patch
111 index b742135..2d9c8f7 100644
112 --- a/9999/0004-Fix-miscompilation-on-ia64-s-gcc-10.patch
113 +++ b/9999/0004-Fix-miscompilation-on-ia64-s-gcc-10.patch
114 @@ -1,7 +1,7 @@
115 -From 88e7fe55212b0110dca46b5d3a4b7be8db404598 Mon Sep 17 00:00:00 2001
116 +From 4aafe3fae7777fec09e2dd3915a8fd33642bba94 Mon Sep 17 00:00:00 2001
117 From: Sergei Trofimovich <slyfox@g.o>
118 Date: Sat, 11 Jul 2020 20:06:51 +0300
119 -Subject: [PATCH 04/12] Fix miscompilation on ia64's gcc-10
120 +Subject: [PATCH 04/10] Fix miscompilation on ia64's gcc-10
121 MIME-Version: 1.0
122 Content-Type: text/plain; charset=UTF-8
123 Content-Transfer-Encoding: 8bit
124 @@ -28,5 +28,5 @@ index aa1de6b361..f6472f1942 100644
125 # define DL_SYSINFO_IMPLEMENTATION \
126 asm (".text\n\t" \
127 --
128 -2.35.1
129 +2.38.2
130
131
132 diff --git a/9999/0005-linux-Do-not-skip-entries-with-zero-d_ino-values-BZ-.patch b/9999/0005-linux-Do-not-skip-entries-with-zero-d_ino-values-BZ-.patch
133 deleted file mode 100644
134 index 33f9869..0000000
135 --- a/9999/0005-linux-Do-not-skip-entries-with-zero-d_ino-values-BZ-.patch
136 +++ /dev/null
137 @@ -1,182 +0,0 @@
138 -From ad50ce9ae10cdd50bd620ae6ef67fe3b11896913 Mon Sep 17 00:00:00 2001
139 -From: Adhemerval Zanella <adhemerval.zanella@××××××.org>
140 -Date: Tue, 20 Oct 2020 12:18:56 -0300
141 -Subject: [PATCH 05/12] linux: Do not skip entries with zero d_ino values [BZ
142 - #12165]
143 -
144 -According to Linux commit 2adc376c55194 (vfs: avoid creation of inode
145 -number 0 in get_next_ino) Linux did not treat d_ino == 0 as a special
146 -case (it is a valid inode number).
147 -
148 -This patch fixes readdir{64} by not ignoring entried with d_ino being
149 -0.
150 -
151 -Checked on x86_64-linux-gnu and i686-linux-gnu.
152 ----
153 - sysdeps/unix/sysv/linux/readdir.c | 59 +++++++++++------------------
154 - sysdeps/unix/sysv/linux/readdir64.c | 59 +++++++++++------------------
155 - 2 files changed, 44 insertions(+), 74 deletions(-)
156 -
157 -diff --git a/sysdeps/unix/sysv/linux/readdir.c b/sysdeps/unix/sysv/linux/readdir.c
158 -index c31f349639..7743f50071 100644
159 ---- a/sysdeps/unix/sysv/linux/readdir.c
160 -+++ b/sysdeps/unix/sysv/linux/readdir.c
161 -@@ -25,51 +25,36 @@
162 - struct dirent *
163 - __readdir_unlocked (DIR *dirp)
164 - {
165 -- struct dirent *dp;
166 -- int saved_errno = errno;
167 -+ const int saved_errno = errno;
168 -
169 -- do
170 -+ if (dirp->offset >= dirp->size)
171 - {
172 -- size_t reclen;
173 --
174 -- if (dirp->offset >= dirp->size)
175 -+ /* We've emptied out our buffer. Refill it. */
176 -+ ssize_t bytes = __getdents (dirp->fd, dirp->data, dirp->allocation);
177 -+ if (bytes <= 0)
178 - {
179 -- /* We've emptied out our buffer. Refill it. */
180 --
181 -- size_t maxread = dirp->allocation;
182 -- ssize_t bytes;
183 --
184 -- bytes = __getdents (dirp->fd, dirp->data, maxread);
185 -- if (bytes <= 0)
186 -- {
187 -- /* On some systems getdents fails with ENOENT when the
188 -- open directory has been rmdir'd already. POSIX.1
189 -- requires that we treat this condition like normal EOF. */
190 -- if (bytes < 0 && errno == ENOENT)
191 -- bytes = 0;
192 --
193 -- /* Don't modifiy errno when reaching EOF. */
194 -- if (bytes == 0)
195 -- __set_errno (saved_errno);
196 -- dp = NULL;
197 -- break;
198 -- }
199 -- dirp->size = (size_t) bytes;
200 --
201 -- /* Reset the offset into the buffer. */
202 -- dirp->offset = 0;
203 -+ /* On some systems getdents fails with ENOENT when the
204 -+ open directory has been rmdir'd already. POSIX.1
205 -+ requires that we treat this condition like normal EOF. */
206 -+ if (bytes < 0 && errno == ENOENT)
207 -+ bytes = 0;
208 -+
209 -+ /* Don't modifiy errno when reaching EOF. */
210 -+ if (bytes == 0)
211 -+ __set_errno (saved_errno);
212 -+ return NULL;
213 - }
214 -+ dirp->size = bytes;
215 -
216 -- dp = (struct dirent *) &dirp->data[dirp->offset];
217 --
218 -- reclen = dp->d_reclen;
219 -+ /* Reset the offset into the buffer. */
220 -+ dirp->offset = 0;
221 -+ }
222 -
223 -- dirp->offset += reclen;
224 -+ struct dirent *dp = (struct dirent *) &dirp->data[dirp->offset];
225 -
226 -- dirp->filepos = dp->d_off;
227 -+ dirp->offset += dp->d_reclen;
228 -
229 -- /* Skip deleted files. */
230 -- } while (dp->d_ino == 0);
231 -+ dirp->filepos = dp->d_off;
232 -
233 - return dp;
234 - }
235 -diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
236 -index e876d84b02..d990a36e4e 100644
237 ---- a/sysdeps/unix/sysv/linux/readdir64.c
238 -+++ b/sysdeps/unix/sysv/linux/readdir64.c
239 -@@ -30,55 +30,40 @@
240 - struct dirent64 *
241 - __readdir64 (DIR *dirp)
242 - {
243 -- struct dirent64 *dp;
244 -- int saved_errno = errno;
245 -+ const int saved_errno = errno;
246 -
247 - #if IS_IN (libc)
248 - __libc_lock_lock (dirp->lock);
249 - #endif
250 -
251 -- do
252 -+ if (dirp->offset >= dirp->size)
253 - {
254 -- size_t reclen;
255 --
256 -- if (dirp->offset >= dirp->size)
257 -+ /* We've emptied out our buffer. Refill it. */
258 -+ ssize_t bytes = __getdents64 (dirp->fd, dirp->data, dirp->allocation);
259 -+ if (bytes <= 0)
260 - {
261 -- /* We've emptied out our buffer. Refill it. */
262 --
263 -- size_t maxread = dirp->allocation;
264 -- ssize_t bytes;
265 --
266 -- bytes = __getdents64 (dirp->fd, dirp->data, maxread);
267 -- if (bytes <= 0)
268 -- {
269 -- /* On some systems getdents fails with ENOENT when the
270 -- open directory has been rmdir'd already. POSIX.1
271 -- requires that we treat this condition like normal EOF. */
272 -- if (bytes < 0 && errno == ENOENT)
273 -- bytes = 0;
274 --
275 -- /* Don't modifiy errno when reaching EOF. */
276 -- if (bytes == 0)
277 -- __set_errno (saved_errno);
278 -- dp = NULL;
279 -- break;
280 -- }
281 -- dirp->size = (size_t) bytes;
282 --
283 -- /* Reset the offset into the buffer. */
284 -- dirp->offset = 0;
285 -+ /* On some systems getdents fails with ENOENT when the
286 -+ open directory has been rmdir'd already. POSIX.1
287 -+ requires that we treat this condition like normal EOF. */
288 -+ if (bytes < 0 && errno == ENOENT)
289 -+ bytes = 0;
290 -+
291 -+ /* Don't modifiy errno when reaching EOF. */
292 -+ if (bytes == 0)
293 -+ __set_errno (saved_errno);
294 -+ return NULL;
295 - }
296 -+ dirp->size = bytes;
297 -
298 -- dp = (struct dirent64 *) &dirp->data[dirp->offset];
299 --
300 -- reclen = dp->d_reclen;
301 -+ /* Reset the offset into the buffer. */
302 -+ dirp->offset = 0;
303 -+ }
304 -
305 -- dirp->offset += reclen;
306 -+ struct dirent64 *dp = (struct dirent64 *) &dirp->data[dirp->offset];
307 -
308 -- dirp->filepos = dp->d_off;
309 -+ dirp->offset += dp->d_reclen;
310 -
311 -- /* Skip deleted files. */
312 -- } while (dp->d_ino == 0);
313 -+ dirp->filepos = dp->d_off;
314 -
315 - #if IS_IN (libc)
316 - __libc_lock_unlock (dirp->lock);
317 ---
318 -2.35.1
319 -
320
321 diff --git a/9999/0006-linux-Use-getdents64-on-non-LFS-readdir.patch b/9999/0005-linux-Use-getdents64-on-non-LFS-readdir.patch
322 similarity index 82%
323 rename from 9999/0006-linux-Use-getdents64-on-non-LFS-readdir.patch
324 rename to 9999/0005-linux-Use-getdents64-on-non-LFS-readdir.patch
325 index b588195..4e1dc0d 100644
326 --- a/9999/0006-linux-Use-getdents64-on-non-LFS-readdir.patch
327 +++ b/9999/0005-linux-Use-getdents64-on-non-LFS-readdir.patch
328 @@ -1,7 +1,7 @@
329 -From 5e92232132d809ca1a4dde473e3b9d061754db90 Mon Sep 17 00:00:00 2001
330 +From 0718c1ca37fe6407bd4bad15dfae873719eabb6e Mon Sep 17 00:00:00 2001
331 From: Adhemerval Zanella <adhemerval.zanella@××××××.org>
332 Date: Tue, 20 Oct 2020 13:37:15 -0300
333 -Subject: [PATCH 06/12] linux: Use getdents64 on non-LFS readdir
334 +Subject: [PATCH 05/10] linux: Use getdents64 on non-LFS readdir
335
336 The opendir allocates a translation buffer to be used to return the
337 non-LFS readdir entry. The obtained dirent64 struct is translated
338 @@ -15,8 +15,8 @@ Checked on x86_64-linux-gnu and i686-linux-gnu.
339 sysdeps/unix/sysv/linux/closedir.c | 4 ++
340 sysdeps/unix/sysv/linux/dirstream.h | 5 ++
341 sysdeps/unix/sysv/linux/opendir.c | 21 +++++++
342 - sysdeps/unix/sysv/linux/readdir.c | 97 +++++++++++++++++++++--------
343 - 4 files changed, 101 insertions(+), 26 deletions(-)
344 + sysdeps/unix/sysv/linux/readdir.c | 94 +++++++++++++++++++++--------
345 + 4 files changed, 98 insertions(+), 26 deletions(-)
346
347 diff --git a/sysdeps/unix/sysv/linux/closedir.c b/sysdeps/unix/sysv/linux/closedir.c
348 index eee0193fc4..d876d49d78 100644
349 @@ -82,10 +82,10 @@ index 9e81d00630..bfd2f382a6 100644
350 #if IS_IN (libc)
351 __libc_lock_init (dirp->lock);
352 diff --git a/sysdeps/unix/sysv/linux/readdir.c b/sysdeps/unix/sysv/linux/readdir.c
353 -index 7743f50071..7b4571839e 100644
354 +index c9a04dc160..c078146d7d 100644
355 --- a/sysdeps/unix/sysv/linux/readdir.c
356 +++ b/sysdeps/unix/sysv/linux/readdir.c
357 -@@ -21,42 +21,87 @@
358 +@@ -21,42 +21,84 @@
359 #if !_DIRENT_MATCHES_DIRENT64
360 #include <dirstream.h>
361
362 @@ -131,39 +131,31 @@ index 7743f50071..7b4571839e 100644
363 struct dirent *
364 __readdir_unlocked (DIR *dirp)
365 {
366 - const int saved_errno = errno;
367 +- struct dirent *dp;
368 + int saved_errno = errno;
369
370 - if (dirp->offset >= dirp->size)
371 + while (1)
372 {
373 - /* We've emptied out our buffer. Refill it. */
374 -- ssize_t bytes = __getdents (dirp->fd, dirp->data, dirp->allocation);
375 +-
376 +- size_t maxread = dirp->allocation;
377 +- ssize_t bytes;
378 +-
379 +- bytes = __getdents (dirp->fd, dirp->data, maxread);
380 - if (bytes <= 0)
381 + if (dirp->offset >= dirp->size)
382 - {
383 -- /* On some systems getdents fails with ENOENT when the
384 -- open directory has been rmdir'd already. POSIX.1
385 -- requires that we treat this condition like normal EOF. */
386 -- if (bytes < 0 && errno == ENOENT)
387 -- bytes = 0;
388 --
389 -- /* Don't modifiy errno when reaching EOF. */
390 -- if (bytes == 0)
391 -- __set_errno (saved_errno);
392 -- return NULL;
393 ++ {
394 + /* We've emptied out our buffer. Refill it. */
395 + ssize_t bytes = __getdents64 (dirp->fd, dirp->data,
396 + dirp->allocation);
397 + if (bytes <= 0)
398 + {
399 -+ /* On some systems getdents fails with ENOENT when the
400 -+ open directory has been rmdir'd already. POSIX.1
401 -+ requires that we treat this condition like normal EOF. */
402 ++ /* Linux may fail with ENOENT on some file systems if the
403 ++ directory inode is marked as dead (deleted). POSIX
404 ++ treats this as a regular end-of-directory condition, so
405 ++ do not set errno in that case, to indicate success. */
406 + if (bytes < 0 && errno == ENOENT)
407 -+ bytes = 0;
408 -+
409 -+ /* Don't modifiy errno when reaching EOF. */
410 -+ if (bytes == 0)
411 + __set_errno (saved_errno);
412 + return NULL;
413 + }
414 @@ -179,20 +171,25 @@ index 7743f50071..7b4571839e 100644
415 + /* Skip entries which might overflow d_off/d_ino or if the translation
416 + buffer can't be resized. */
417 + if (dirstream_entry (dirp, dp64))
418 -+ {
419 + {
420 +- /* Linux may fail with ENOENT on some file systems if the
421 +- directory inode is marked as dead (deleted). POSIX
422 +- treats this as a regular end-of-directory condition, so
423 +- do not set errno in that case, to indicate success. */
424 +- if (bytes == 0 || errno == ENOENT)
425 +- __set_errno (saved_errno);
426 +- return NULL;
427 + dirp->filepos = dp64->d_off;
428 + return (struct dirent *) dirp->tbuffer;
429 }
430 -- dirp->size = bytes;
431 +- dirp->size = (size_t) bytes;
432 -
433 - /* Reset the offset into the buffer. */
434 - dirp->offset = 0;
435 }
436 -
437 -- struct dirent *dp = (struct dirent *) &dirp->data[dirp->offset];
438 --
439 +- dp = (struct dirent *) &dirp->data[dirp->offset];
440 - dirp->offset += dp->d_reclen;
441 --
442 - dirp->filepos = dp->d_off;
443 -
444 - return dp;
445 @@ -200,5 +197,5 @@ index 7743f50071..7b4571839e 100644
446
447 struct dirent *
448 --
449 -2.35.1
450 +2.38.2
451
452
453 diff --git a/9999/0007-linux-Set-internal-DIR-filepos-as-off64_t-BZ-23960-B.patch b/9999/0006-linux-Set-internal-DIR-filepos-as-off64_t-BZ-23960-B.patch
454 similarity index 98%
455 rename from 9999/0007-linux-Set-internal-DIR-filepos-as-off64_t-BZ-23960-B.patch
456 rename to 9999/0006-linux-Set-internal-DIR-filepos-as-off64_t-BZ-23960-B.patch
457 index a239bbc..38acaf8 100644
458 --- a/9999/0007-linux-Set-internal-DIR-filepos-as-off64_t-BZ-23960-B.patch
459 +++ b/9999/0006-linux-Set-internal-DIR-filepos-as-off64_t-BZ-23960-B.patch
460 @@ -1,7 +1,7 @@
461 -From a9813305234d6163d86aa78c062017f05b7a79d6 Mon Sep 17 00:00:00 2001
462 +From 36f553f67b8268341b7879640637fac5ea806017 Mon Sep 17 00:00:00 2001
463 From: Adhemerval Zanella <adhemerval.zanella@××××××.org>
464 Date: Mon, 13 Apr 2020 18:09:20 -0300
465 -Subject: [PATCH 07/12] linux: Set internal DIR filepos as off64_t [BZ #23960,
466 +Subject: [PATCH 06/10] linux: Set internal DIR filepos as off64_t [BZ #23960,
467 BZ #24050]
468
469 It allows to obtain the expected entry offset on telldir and set
470 @@ -39,7 +39,7 @@ and arm-linux-gnueabihf.
471 create mode 100644 sysdeps/unix/sysv/linux/telldir.h
472
473 diff --git a/dirent/Makefile b/dirent/Makefile
474 -index b80f6a73ea..65119db578 100644
475 +index cfa61826ed..9a9d91b8a5 100644
476 --- a/dirent/Makefile
477 +++ b/dirent/Makefile
478 @@ -31,7 +31,7 @@ routines := opendir closedir readdir readdir_r rewinddir \
479 @@ -276,7 +276,7 @@ index bfd2f382a6..9a0b7ab4c4 100644
480 return dirp;
481 }
482 diff --git a/sysdeps/unix/sysv/linux/readdir.c b/sysdeps/unix/sysv/linux/readdir.c
483 -index 7b4571839e..94ac4cbae7 100644
484 +index c078146d7d..f377e5f268 100644
485 --- a/sysdeps/unix/sysv/linux/readdir.c
486 +++ b/sysdeps/unix/sysv/linux/readdir.c
487 @@ -17,6 +17,7 @@
488 @@ -490,5 +490,5 @@ index 0000000000..7c45886341
489 +
490 +#endif /* _TELLDIR_H */
491 --
492 -2.35.1
493 +2.38.2
494
495
496 diff --git a/9999/0008-linux-Add-__readdir64_unlocked.patch b/9999/0007-linux-Add-__readdir64_unlocked.patch
497 similarity index 93%
498 rename from 9999/0008-linux-Add-__readdir64_unlocked.patch
499 rename to 9999/0007-linux-Add-__readdir64_unlocked.patch
500 index 540ddf7..631550c 100644
501 --- a/9999/0008-linux-Add-__readdir64_unlocked.patch
502 +++ b/9999/0007-linux-Add-__readdir64_unlocked.patch
503 @@ -1,7 +1,7 @@
504 -From 81cdcf158a683bb9c999967de2e332e5c5881bc9 Mon Sep 17 00:00:00 2001
505 +From 4cca67d0d2d615918e05db864c236e33c0fda8f3 Mon Sep 17 00:00:00 2001
506 From: Adhemerval Zanella <adhemerval.zanella@××××××.org>
507 Date: Mon, 13 Apr 2020 08:35:40 -0300
508 -Subject: [PATCH 08/12] linux: Add __readdir64_unlocked
509 +Subject: [PATCH 07/10] linux: Add __readdir64_unlocked
510
511 And use it on readdir_r implementation.
512
513 @@ -25,17 +25,18 @@ index d7567f5e86..0c6715d0e4 100644
514 libc_hidden_proto (__readdir64)
515 extern int __readdir_r (DIR *__dirp, struct dirent *__entry,
516 diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
517 -index d990a36e4e..c4539f6d96 100644
518 +index 7952da5c27..9d82054182 100644
519 --- a/sysdeps/unix/sysv/linux/readdir64.c
520 +++ b/sysdeps/unix/sysv/linux/readdir64.c
521 -@@ -28,14 +28,10 @@
522 +@@ -28,15 +28,11 @@
523
524 /* Read a directory entry from DIRP. */
525 struct dirent64 *
526 -__readdir64 (DIR *dirp)
527 +__readdir64_unlocked (DIR *dirp)
528 {
529 - const int saved_errno = errno;
530 + struct dirent64 *dp;
531 + int saved_errno = errno;
532
533 -#if IS_IN (libc)
534 - __libc_lock_lock (dirp->lock);
535 @@ -44,8 +45,8 @@ index d990a36e4e..c4539f6d96 100644
536 if (dirp->offset >= dirp->size)
537 {
538 /* We've emptied out our buffer. Refill it. */
539 -@@ -65,6 +61,20 @@ __readdir64 (DIR *dirp)
540 -
541 +@@ -68,6 +64,20 @@ __readdir64 (DIR *dirp)
542 + dirp->offset += dp->d_reclen;
543 dirp->filepos = dp->d_off;
544
545 + return dp;
546 @@ -177,5 +178,5 @@ index afd7f9af0f..32962a176a 100644
547
548
549 --
550 -2.35.1
551 +2.38.2
552
553
554 diff --git a/9999/0009-linux-Add-__old_readdir64_unlocked.patch b/9999/0008-linux-Add-__old_readdir64_unlocked.patch
555 similarity index 84%
556 rename from 9999/0009-linux-Add-__old_readdir64_unlocked.patch
557 rename to 9999/0008-linux-Add-__old_readdir64_unlocked.patch
558 index 52af81a..3cd2923 100644
559 --- a/9999/0009-linux-Add-__old_readdir64_unlocked.patch
560 +++ b/9999/0008-linux-Add-__old_readdir64_unlocked.patch
561 @@ -1,16 +1,16 @@
562 -From 82605e1450880ac7d40f1b5d12eecbf2f0815535 Mon Sep 17 00:00:00 2001
563 +From cd6d96ae0a09c1bff40f19d54e2910d7d4e74864 Mon Sep 17 00:00:00 2001
564 From: Adhemerval Zanella <adhemerval.zanella@××××××.org>
565 Date: Tue, 14 Apr 2020 11:14:22 -0300
566 -Subject: [PATCH 09/12] linux: Add __old_readdir64_unlocked
567 +Subject: [PATCH 08/10] linux: Add __old_readdir64_unlocked
568
569 And use it __old_readdir64_r.
570
571 Checked on i686-linux-gnu.
572 ---
573 sysdeps/unix/sysv/linux/olddirent.h | 2 +
574 - sysdeps/unix/sysv/linux/readdir64.c | 21 +++++--
575 + sysdeps/unix/sysv/linux/readdir64.c | 24 +++++---
576 sysdeps/unix/sysv/linux/readdir64_r.c | 79 ++++++---------------------
577 - 3 files changed, 35 insertions(+), 67 deletions(-)
578 + 3 files changed, 35 insertions(+), 70 deletions(-)
579
580 diff --git a/sysdeps/unix/sysv/linux/olddirent.h b/sysdeps/unix/sysv/linux/olddirent.h
581 index 9a22609177..00c84b9521 100644
582 @@ -26,10 +26,10 @@ index 9a22609177..00c84b9521 100644
583 struct __old_dirent64 **__result);
584 extern __ssize_t __old_getdents64 (int __fd, char *__buf, size_t __nbytes)
585 diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
586 -index c4539f6d96..dbf6a8c54d 100644
587 +index 9d82054182..bbe247f95d 100644
588 --- a/sysdeps/unix/sysv/linux/readdir64.c
589 +++ b/sysdeps/unix/sysv/linux/readdir64.c
590 -@@ -101,15 +101,11 @@ versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
591 +@@ -104,15 +104,11 @@ versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
592
593 attribute_compat_text_section
594 struct __old_dirent64 *
595 @@ -43,12 +43,22 @@ index c4539f6d96..dbf6a8c54d 100644
596 - __libc_lock_lock (dirp->lock);
597 -#endif
598 -
599 - do
600 + if (dirp->offset >= dirp->size)
601 {
602 - size_t reclen;
603 -@@ -153,6 +149,21 @@ __old_readdir64 (DIR *dirp)
604 - /* Skip deleted files. */
605 - } while (dp->d_ino == 0);
606 + /* We've emptied out our buffer. Refill it. */
607 +@@ -129,9 +125,6 @@ __old_readdir64 (DIR *dirp)
608 + do not set errno in that case, to indicate success. */
609 + if (bytes == 0 || errno == ENOENT)
610 + __set_errno (saved_errno);
611 +-#if IS_IN (libc)
612 +- __libc_lock_unlock (dirp->lock);
613 +-#endif
614 + return NULL;
615 + }
616 + dirp->size = (size_t) bytes;
617 +@@ -144,6 +137,21 @@ __old_readdir64 (DIR *dirp)
618 + dirp->offset += dp->d_reclen;
619 + dirp->filepos = dp->d_off;
620
621 + return dp;
622 +}
623 @@ -180,5 +190,5 @@ index 32962a176a..699d120b76 100644
624
625 compat_symbol (libc, __old_readdir64_r, readdir64_r, GLIBC_2_1);
626 --
627 -2.35.1
628 +2.38.2
629
630
631 diff --git a/9999/0010-linux-Use-getdents64-on-readdir64-compat-implementat.patch b/9999/0009-linux-Use-getdents64-on-readdir64-compat-implementat.patch
632 similarity index 78%
633 rename from 9999/0010-linux-Use-getdents64-on-readdir64-compat-implementat.patch
634 rename to 9999/0009-linux-Use-getdents64-on-readdir64-compat-implementat.patch
635 index 5bbea04..7a9c5a3 100644
636 --- a/9999/0010-linux-Use-getdents64-on-readdir64-compat-implementat.patch
637 +++ b/9999/0009-linux-Use-getdents64-on-readdir64-compat-implementat.patch
638 @@ -1,7 +1,7 @@
639 -From 7a72e18a7b710feea5375578450e11a106336102 Mon Sep 17 00:00:00 2001
640 +From c71a60022adc7c9b7e37a813e2abad0d0724245a Mon Sep 17 00:00:00 2001
641 From: Adhemerval Zanella <adhemerval.zanella@××××××.org>
642 Date: Tue, 20 Oct 2020 16:00:43 -0300
643 -Subject: [PATCH 10/12] linux: Use getdents64 on readdir64 compat
644 +Subject: [PATCH 09/10] linux: Use getdents64 on readdir64 compat
645 implementation
646
647 It uses a similar strategy from the non-LFS readdir that also
648 @@ -12,11 +12,11 @@ It allows to remove __old_getdents64.
649
650 Checked on i686-linux-gnu.
651 ---
652 - sysdeps/unix/sysv/linux/getdents64.c | 93 ------------------------
653 - sysdeps/unix/sysv/linux/olddirent.h | 2 -
654 - sysdeps/unix/sysv/linux/opendir.c | 15 +++-
655 - sysdeps/unix/sysv/linux/readdir64.c | 104 +++++++++++++++++----------
656 - 4 files changed, 79 insertions(+), 135 deletions(-)
657 + sysdeps/unix/sysv/linux/getdents64.c | 93 ----------------------------
658 + sysdeps/unix/sysv/linux/olddirent.h | 2 -
659 + sysdeps/unix/sysv/linux/opendir.c | 15 ++++-
660 + sysdeps/unix/sysv/linux/readdir64.c | 62 +++++++++++++++----
661 + 4 files changed, 64 insertions(+), 108 deletions(-)
662
663 diff --git a/sysdeps/unix/sysv/linux/getdents64.c b/sysdeps/unix/sysv/linux/getdents64.c
664 index 510a586859..92481526c5 100644
665 @@ -167,10 +167,10 @@ index 9a0b7ab4c4..df40b0a64e 100644
666 dirp->tbuffer = malloc (tbuffer_size);
667 if (dirp->tbuffer == NULL)
668 diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
669 -index dbf6a8c54d..4b41299c6c 100644
670 +index bbe247f95d..01e834e238 100644
671 --- a/sysdeps/unix/sysv/linux/readdir64.c
672 +++ b/sysdeps/unix/sysv/linux/readdir64.c
673 -@@ -99,57 +99,83 @@ versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
674 +@@ -102,21 +102,52 @@ versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2);
675 # if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
676 # include <olddirent.h>
677
678 @@ -218,68 +218,36 @@ index dbf6a8c54d..4b41299c6c 100644
679 - int saved_errno = errno;
680 + const int saved_errno = errno;
681
682 -- do
683 -+ if (dirp->offset >= dirp->size)
684 + if (dirp->offset >= dirp->size)
685 {
686 -- size_t reclen;
687 + /* We've emptied out our buffer. Refill it. */
688 -
689 -- if (dirp->offset >= dirp->size)
690 -+ /* We've emptied out our buffer. Refill it. */
691 +- size_t maxread = dirp->allocation;
692 +- ssize_t bytes;
693 +-
694 +- bytes = __old_getdents64 (dirp->fd, dirp->data, maxread);
695 + ssize_t bytes = __getdents64 (dirp->fd, dirp->data, dirp->allocation);
696 -+ if (bytes <= 0)
697 + if (bytes <= 0)
698 {
699 -- /* We've emptied out our buffer. Refill it. */
700 --
701 -- size_t maxread = dirp->allocation;
702 -- ssize_t bytes;
703 --
704 -- bytes = __old_getdents64 (dirp->fd, dirp->data, maxread);
705 -- if (bytes <= 0)
706 -- {
707 -- /* On some systems getdents fails with ENOENT when the
708 -- open directory has been rmdir'd already. POSIX.1
709 -- requires that we treat this condition like normal EOF. */
710 -- if (bytes < 0 && errno == ENOENT)
711 -- bytes = 0;
712 --
713 -- /* Don't modifiy errno when reaching EOF. */
714 -- if (bytes == 0)
715 -- __set_errno (saved_errno);
716 -- dp = NULL;
717 -- break;
718 -- }
719 -- dirp->size = (size_t) bytes;
720 --
721 -- /* Reset the offset into the buffer. */
722 -- dirp->offset = 0;
723 -- }
724 --
725 -- dp = (struct __old_dirent64 *) &dirp->data[dirp->offset];
726 -+ /* On some systems getdents fails with ENOENT when the
727 -+ open directory has been rmdir'd already. POSIX.1
728 -+ requires that we treat this condition like normal EOF. */
729 -+ if (bytes < 0 && errno == ENOENT)
730 -+ bytes = 0;
731 -
732 -- reclen = dp->d_reclen;
733 -+ /* Don't modifiy errno when reaching EOF. */
734 -+ if (bytes == 0)
735 -+ __set_errno (saved_errno);
736 -+ return NULL;
737 -+ }
738 + /* Linux may fail with ENOENT on some file systems if the
739 +@@ -127,17 +158,24 @@ __old_readdir64_unlocked (DIR *dirp)
740 + __set_errno (saved_errno);
741 + return NULL;
742 + }
743 +- dirp->size = (size_t) bytes;
744 + dirp->size = bytes;
745
746 -- dirp->offset += reclen;
747 -+ /* Reset the offset into the buffer. */
748 -+ dirp->offset = 0;
749 -+ }
750 + /* Reset the offset into the buffer. */
751 + dirp->offset = 0;
752 + }
753
754 -- dirp->filepos = dp->d_off;
755 +- dp = (struct __old_dirent64 *) &dirp->data[dirp->offset];
756 +- dirp->offset += dp->d_reclen;
757 +- dirp->filepos = dp->d_off;
758 + struct dirent64 *dp64 = (struct dirent64 *) &dirp->data[dirp->offset];
759 + dirp->offset += dp64->d_reclen;
760
761 -- /* Skip deleted files. */
762 -- } while (dp->d_ino == 0);
763 +- return dp;
764 + /* Skip entries which might overflow d_ino or for memory allocation failure
765 + in case of large file names. */
766 + if (dirstream_old_entry (dirp, dp64))
767 @@ -287,12 +255,11 @@ index dbf6a8c54d..4b41299c6c 100644
768 + dirp->filepos = dp64->d_off;
769 + return (struct __old_dirent64 *) dirp->tbuffer;
770 + }
771 -
772 -- return dp;
773 ++
774 + return NULL;
775 }
776
777 attribute_compat_text_section
778 --
779 -2.35.1
780 +2.38.2
781
782
783 diff --git a/9999/0011-dirent-Deprecate-getdirentries.patch b/9999/0010-dirent-Deprecate-getdirentries.patch
784 similarity index 82%
785 rename from 9999/0011-dirent-Deprecate-getdirentries.patch
786 rename to 9999/0010-dirent-Deprecate-getdirentries.patch
787 index c7abd61..28f744a 100644
788 --- a/9999/0011-dirent-Deprecate-getdirentries.patch
789 +++ b/9999/0010-dirent-Deprecate-getdirentries.patch
790 @@ -1,7 +1,7 @@
791 -From fe14184069e952f57e74f1e599816d0403205ac0 Mon Sep 17 00:00:00 2001
792 +From 2f0668caf22acf6493dce8dcfd670e4b35fb6892 Mon Sep 17 00:00:00 2001
793 From: Adhemerval Zanella <adhemerval.zanella@××××××.org>
794 Date: Fri, 17 Apr 2020 09:59:51 -0300
795 -Subject: [PATCH 11/12] dirent: Deprecate getdirentries
796 +Subject: [PATCH 10/10] dirent: Deprecate getdirentries
797
798 The interface has some issues:
799
800 @@ -17,28 +17,25 @@ The interface has some issues:
801
802 The idea is to eventually move the symbols to compat ones.
803 ---
804 - NEWS | 6 ++++++
805 + NEWS | 3 +++
806 dirent/dirent.h | 14 ++++++++++----
807 sysdeps/unix/sysv/linux/Makefile | 4 ++++
808 - 3 files changed, 20 insertions(+), 4 deletions(-)
809 + 3 files changed, 17 insertions(+), 4 deletions(-)
810
811 diff --git a/NEWS b/NEWS
812 -index bc1aac1270..56c4d3ed7e 100644
813 +index a10bb08fb0..2b4ed6bbc1 100644
814 --- a/NEWS
815 +++ b/NEWS
816 -@@ -93,6 +93,12 @@ Security related changes:
817 +@@ -21,6 +21,9 @@ Deprecated and removed features, and other changes affecting compatibility:
818 + corresponds to the AT_PLATFORM system name, or employs the legacy AT_HWCAP
819 + search mechanism, which was deprecated in version 2.33.
820
821 - [Add security related changes here]
822 -
823 -+Deprecated and removed features, and other changes affecting compatibility:
824 -+
825 +* The function getdirentries is now deprecated, applications should use
826 + either getdents64, readdir64 or readdir.
827 +
828 -+
829 - The following bugs are resolved with this release:
830 + Changes to build and runtime requirements:
831
832 - [The release manager will add the list generated by
833 + [Add changes to build and runtime requirements here]
834 diff --git a/dirent/dirent.h b/dirent/dirent.h
835 index c47d3273b2..1c299e5be8 100644
836 --- a/dirent/dirent.h
837 @@ -84,10 +81,10 @@ index c47d3273b2..1c299e5be8 100644
838 #endif /* Use misc. */
839
840 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
841 -index a139a16532..237b8ca80a 100644
842 +index f298878e8f..41e5341450 100644
843 --- a/sysdeps/unix/sysv/linux/Makefile
844 +++ b/sysdeps/unix/sysv/linux/Makefile
845 -@@ -365,6 +365,10 @@ tests += \
846 +@@ -467,6 +467,10 @@ tests += \
847 tst-getdents64 \
848 tst-readdir64-compat \
849 # tests
850 @@ -99,5 +96,5 @@ index a139a16532..237b8ca80a 100644
851
852 ifeq ($(subdir),nis)
853 --
854 -2.35.1
855 +2.38.2