Searched hist:"9 d6d5a71313e9970cfbf872a197eb25f5c67948d" (Results 1 – 2 of 2) sorted by relevance
/freebsd/usr.bin/find/ |
H A D | function.c | diff 9d6d5a71313e9970cfbf872a197eb25f5c67948d Fri Aug 02 16:14:23 CEST 2013 Jilles Tjoelker <jilles@FreeBSD.org> find: Allow -delete to delete files given as arguments.
Formerly, a command like find dir1/dir2 -delete would delete everything under dir1/dir2 but not dir1/dir2 itself.
When -L is not specified and "." can be opened, the fts(3) code underlying find(1) is careful to avoid following symlinks or being dropped in different locations by moving the directory fts is currently traversing. If a problematic concurrent modification is detected, fts will not enter the directory or abort. Files found in the search are returned via the current working directory and a pathname not containing a slash.
For paranoia, find(1) verifies this when -delete is used. However, it is too paranoid about the root of the traversal. It is already assumed that the initial pathname does not refer to directories or symlinks that might be replaced by untrusted users; otherwise, the whole traversal would be unsafe. Therefore, it is not necessary to do the check for fts_level == FTS_ROOTLEVEL.
Deleting the pathnames given as arguments can be prevented without error messages using -mindepth 1 or by changing directory and passing "." as argument to find. This works in the old as well as the new version of find.
Tested by: Kurt Lidl Reviewed by: jhb
|
/freebsd/ |
H A D | UPDATING | diff 9d6d5a71313e9970cfbf872a197eb25f5c67948d Fri Aug 02 16:14:23 CEST 2013 Jilles Tjoelker <jilles@FreeBSD.org> find: Allow -delete to delete files given as arguments.
Formerly, a command like find dir1/dir2 -delete would delete everything under dir1/dir2 but not dir1/dir2 itself.
When -L is not specified and "." can be opened, the fts(3) code underlying find(1) is careful to avoid following symlinks or being dropped in different locations by moving the directory fts is currently traversing. If a problematic concurrent modification is detected, fts will not enter the directory or abort. Files found in the search are returned via the current working directory and a pathname not containing a slash.
For paranoia, find(1) verifies this when -delete is used. However, it is too paranoid about the root of the traversal. It is already assumed that the initial pathname does not refer to directories or symlinks that might be replaced by untrusted users; otherwise, the whole traversal would be unsafe. Therefore, it is not necessary to do the check for fts_level == FTS_ROOTLEVEL.
Deleting the pathnames given as arguments can be prevented without error messages using -mindepth 1 or by changing directory and passing "." as argument to find. This works in the old as well as the new version of find.
Tested by: Kurt Lidl Reviewed by: jhb
|