public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/28831] New: nftw: combination of FTW_CHDIR with FTW_DEPTH is unusable
@ 2022-01-27 15:26 mj at ucw dot cz
0 siblings, 0 replies; only message in thread
From: mj at ucw dot cz @ 2022-01-27 15:26 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28831
Bug ID: 28831
Summary: nftw: combination of FTW_CHDIR with FTW_DEPTH is
unusable
Product: glibc
Version: 2.36
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: mj at ucw dot cz
CC: drepper.fsp at gmail dot com
Target Milestone: ---
I am using nftw with both FTW_CHDIR and FTW_DEPTH. Every subdirectory is
correctly reported after all its entries, but at that point, the cwd is still
inside the subdirectory. I would expect cwd pointing to the parent directory,
so that the name of the subdirectory is accessible relative to the cwd.
The current behavior contradicts the documentation. "info libc" says:
‘FTW_CHDIR’
If this flag is given the current working directory is changed
to the directory of the reported object before the callback
function is called. When ‘ntfw’ finally returns the current
directory is restored to its original value.
If I understand this correctly, the "reported object" is the subdirectory, so
the "directory of the reported object" is the parent directory.
BTW, my use case is this: I would like to unlink a directory tree recursively.
I need to use FTW_DEPTH, since a directory can be unlinked only if all its
contents are already gone. Without FTW_CHDIR, recursive unlinking is prone to
symlink attacks.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-27 15:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 15:26 [Bug libc/28831] New: nftw: combination of FTW_CHDIR with FTW_DEPTH is unusable mj at ucw dot cz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).