coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lib/dirfd.c: compiler warning: unused parameter


From: Bernhard Voelker
Subject: Re: lib/dirfd.c: compiler warning: unused parameter
Date: Sun, 7 May 2023 20:16:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

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

        dirfd: Fix bogus override (regression 2023-04-26).
        Reported by Bjarni Ingi Gislason <bjarniig@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

Attachment: 0001-build-update-gnulib-submodule-to-latest.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]