Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] fts(3): allow FTS_LOGICAL without FTS_NOCHDIR

0 views
Skip to first unread message

Jilles Tjoelker

unread,
Jan 1, 2010, 4:28:18 PM1/1/10
to freebsd...@freebsd.org
fts(3) currently automatically enables FTS_NOCHDIR if FTS_LOGICAL (-L in
various utilities) is used, according to a comment because symlinks are
too hard. However, the effect of fts_instr=FTS_FOLLOW seems quite
similar to FTS_LOGICAL in chdir mode. Using one more bit in fts_flags, I
made FTS_LOGICAL work with chdir.

This has several advantages:
* it runs faster
* it eliminates the PATH_MAX restriction on deep directory trees
* find -L ... -type l -delete can be made to work without ugliness
(although it is of course still insecure if run over directory trees
where untrusted users have write access)

Question: why are the values for fts_flags in the public header file
fts.h, even though they are supposedly private?

In case the mailing list eats the patch, it is also available here:
http://www.stack.nl/~jilles/unix/fts-logical-chdir.patch

--
Jilles Tjoelker

fts-logical-chdir.patch
0 new messages