From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7FF7C382CC8F; Tue, 7 Jun 2022 07:28:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FF7C382CC8F From: "fweimer at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/29228] ftw() does not find all directories Date: Tue, 07 Jun 2022 07:28:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.35 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2022 07:28:23 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29228 --- Comment #5 from Florian Weimer --- I think what happens is that /usr/local/share/man is a symbolic link to /usr/local/man: write(1, "/usr/local/share\n", 17) =3D 17 getdents64(4, [{d_ino=3D546496505, d_off=3D10, d_reclen=3D24, d_type=3DDT_D= IR, d_name=3D"."}, {d_ino=3D4894502, d_off=3D12, d_reclen=3D24, d_type=3DDT_DIR, d_name=3D".."}, {d_ino=3D546496506, d_off=3D512, d_reclen=3D24, d_type=3DDT= _LNK, d_name=3D"man"}], 32768) =3D 72 newfstatat(4, "man", {st_dev=3Dmakedev(0x103, 0x2), st_ino=3D269461327, st_mode=3DS_IFDIR|0755, st_nlink=3D2, st_uid=3D0, st_gid=3D0, st_blksize=3D= 4096, st_blocks=3D0, st_size=3D6, st_atime=3D1654568737 /* 2022-06-07T10:25:37.801839898+0800 */, st_atime_nsec=3D801839898, st_mtime=3D1654525540 /* 2022-06-06T22:25:40.073638960+0800 */, st_mtime_nsec=3D73638960, st_ctime=3D1654568715 /* 2022-06-07T10:25:15.622300272+0800 */, st_ctime_nsec=3D622300272}, 0) =3D 0 openat(4, "man", O_RDONLY|O_NONBLOCK|O_DIRECTORY) =3D 5 newfstatat(5, "", {st_dev=3Dmakedev(0x103, 0x2), st_ino=3D269461327, st_mode=3DS_IFDIR|0755, st_nlink=3D2, st_uid=3D0, st_gid=3D0, st_blksize=3D= 4096, st_blocks=3D0, st_size=3D6, st_atime=3D1654568737 /* 2022-06-07T10:25:37.801839898+0800 */, st_atime_nsec=3D801839898, st_mtime=3D1654525540 /* 2022-06-06T22:25:40.073638960+0800 */, st_mtime_nsec=3D73638960, st_ctime=3D1654568715 /* 2022-06-07T10:25:15.622300272+0800 */, st_ctime_nsec=3D622300272}, AT_EMPTY= _PATH) =3D 0 ftw follows symbolic links, but detects reoccurring directories (to avoid loops). For nftw, there is the FTW_PHYS flag to disable symbolic link processing. There is also FTW_DEPTH, which suggests that the default (witho= ut the flag) should be breadth-first, and that is not strictly the case here. = But even if we switched to strict breadth-first (which is likely not a backwards-compatible change), it would not address unpredictable results in= the case of symbolic links between cousins (at the same depth). Which directory= is in the output would still depend on directory iteration order, which can va= ry between systems that have the same directory contents. I'm inclined to close this as NOTABUG. --=20 You are receiving this mail because: You are on the CC list for the bug.=