From 2328d8dbb5a8c774afb99d363b6e98cd25ee304d Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 9 Jul 2017 16:35:38 -0400 Subject: Handle ENOTDIR the same as ENOENT For a/b/c, ENOTDIR is returned instead of ENOENT if a or b are not directories. Handle this uniformly when detecting broken symlinks, readdir races, etc. --- tests.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests.sh') diff --git a/tests.sh b/tests.sh index c8aeb63..b150046 100755 --- a/tests.sh +++ b/tests.sh @@ -74,6 +74,7 @@ function make_links() { ln -s ../../d "$1/d/e/g" ln -s d/e "$1/h" ln -s q "$1/d/e/i" + ln -s b/c "$1/j" } make_links "$TMP/links" @@ -299,6 +300,7 @@ gnu_tests=( test_flag_double_dash test_ignore_readdir_race test_ignore_readdir_race_root + test_ignore_readdir_race_notdir test_perm_222_slash test_perm_644_slash test_perm_symbolic_slash @@ -797,6 +799,14 @@ function test_ignore_readdir_race_root() { ! $BFS basic/nonexistent -ignore_readdir_race 2>/dev/null } +function test_ignore_readdir_race_notdir() { + # Check -ignore_readdir_race handling when a directory is replaced with a file + rm -rf scratch/* + touchp scratch/foo/bar + + $BFS scratch -mindepth 1 -ignore_readdir_race -execdir rm -r '{}' \; -execdir touch '{}' \; +} + function test_perm_222() { bfs_diff perms -perm 222 } -- cgit v1.2.3