On 5/5/23 12:13, Bruno Haible wrote:
2023-05-05  Bruno Haible  <br...@clisp.org>

        dirfd: Fix bogus override (regression 2023-04-26).
        Reported by Bjarni Ingi Gislason <bjarn...@simnet.is> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2023-05/msg00040.html>.
        * m4/dirfd.m4 (gl_FUNC_DIRFD): Fix mistake in last change.


Gnulib commit 3f0950f65abb (2023-04-26) not only lead to build time
issues, but also made e.g. coreutils' rm(1) fail:

  $ mkdir d && (cd d && seq 400000 | xargs touch )

  $ rm -rf d
  rm: traversal failed: d: Operation not supported

I can confirm that this gnulib commit d4d8abb39eb0 fixes the issue again.

I noticed the issue because the following "very-expensive" tests failed
(which succeeded with coreutils-9.3):

  FAIL: tests/rm/ext3-perf
  FAIL: tests/rm/many-dir-entries-vs-OOM

`strace -o strace.log -v rm -rf d` (with 'd' as directory containing 400000 
empty files)
shows nothing special:

  ...
  unlinkat(4, "399970", 0)                = 0
  unlinkat(4, "399972", 0)                = 0
  unlinkat(4, "399979", 0)                = 0
  unlinkat(4, "399981", 0)                = 0
  brk(0x1fd2000)                          = 0x1fd2000
  unlinkat(4, "399986", 0)                = 0
  unlinkat(4, "399987", 0)                = 0
  unlinkat(4, "399992", 0)                = 0
  unlinkat(4, "399994", 0)                = 0
  close(3)                                = 0
  close(4)                                = 0
  write(2, "/home/berny/coreutils/src/rm: ", 30) = 30
  write(2, "traversal failed: d", 19)     = 19
  write(2, ": Operation not supported", 25) = 25
  write(2, "\n", 1)                       = 1
  munmap(0x7f28ad13e000, 802816)          = 0
  lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
  close(0)                                = 0
  close(1)                                = 0
  close(2)                                = 0
  exit_group(1)                           = ?
  +++ exited with 1 +++

But the number of unlinkat() invocations is suspicious:

  $ grep unlinkat strace.log | wc -l
  100000

AFAIR this is the number of directory entries which FTS is caching internally,
before it starts another getdents64().

Then I went back the coreutils commits until the test first failed,
which was coreutils commit 941027eeb for the gnulib update, and the
went for and back and forth in the gnulib history.

The attached coreutils patch updates gnulib to latest to fix the bug.

Have a nice day,
Berny
From 131f5c998d5eecfcaed46ea3b5ca2ac93b3737fa Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <m...@bernhard-voelker.de>
Date: Sun, 7 May 2023 17:33:49 +0200
Subject: [PATCH] build: update gnulib submodule to latest

This fixes failures in "very-expensive" tests on FTS with many
directory entries:
  FAIL: tests/rm/ext3-perf
  FAIL: tests/rm/many-dir-entries-vs-OOM

The following shows the problem in the former of the above tests:
  $ mkdir d && seq 400000 | env -C d xargs touch )
  $ rm -rf d
  rm: traversal failed: d: Operation not supported

Gnulib commit 3f0950f65abb (2023-04-26) introduced this regression
which was fixed again with gnulib commit d4d8abb39eb0.

See discussion in
<https://lists.gnu.org/r/bug-gnulib/2023-05/msg00040.html>

* bootstrap.conf (gnulib_modules): Change "year2038-required" to
"year2038-recommended"; the module has been replaced.
* gnulib: Update to latest.
* tests/init.sh: Likewise.
---
 bootstrap.conf | 2 +-
 gnulib         | 2 +-
 tests/init.sh  | 7 ++++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index eca4edb73..7ab5f5895 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -318,7 +318,7 @@ gnulib_modules="
   xstrtol-error
   xstrtold
   xstrtoumax
-  year2038-required
+  year2038-recommended
   yesno
 "
 
diff --git a/gnulib b/gnulib
index d52f9c519..9f205ff96 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit d52f9c5197805e44c867819c2f1a4e1b4a195740
+Subproject commit 9f205ff9624b8e10b4331432c59bc732b8c1a7fe
diff --git a/tests/init.sh b/tests/init.sh
index 6c0939286..0494097e9 100755
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -646,18 +646,19 @@ compare_dev_null_ ()
 
 for diff_opt_ in -u -U3 -c '' no; do
   test "$diff_opt_" != no &&
-    diff_out_=`exec 2>/dev/null; diff $diff_opt_ "$0" "$0" < /dev/null` &&
+    diff_out_=`exec 2>/dev/null
+      LC_ALL=C diff $diff_opt_ "$0" "$0" < /dev/null` &&
     break
 done
 if test "$diff_opt_" != no; then
   if test -z "$diff_out_"; then
-    compare_ () { diff $diff_opt_ "$@"; }
+    compare_ () { LC_ALL=C diff $diff_opt_ "$@"; }
   else
     compare_ ()
     {
       # If no differences were found, AIX and HP-UX 'diff' produce output
       # like "No differences encountered".  Hide this output.
-      diff $diff_opt_ "$@" > diff.out
+      LC_ALL=C diff $diff_opt_ "$@" > diff.out
       diff_status_=$?
       test $diff_status_ -eq 0 || cat diff.out || diff_status_=2
       rm -f diff.out || diff_status_=2
-- 
2.40.1

Reply via email to