From 09eda9ed9d386f3aa84bfff1699cc4cfcec8647e Mon Sep 17 00:00:00 2001 From: Dylan Simon Date: Tue, 18 Mar 2014 11:50:29 -0400 Subject: chmod: fix erroneous warnings with -R --changes For files with "special" bits set, we would stat the relative file name in the wrong directory, giving an erroneous ENOENT diagnostic. This issue was introduced with commit v5.92-653-gc1994c1 which changed fts to not change directory on traversal. * src/chmod.c (mode_changed): Use fts->fts_cwd_fd with fstatat rather than stat. All callers changed. * tests/chmod/c-option.sh: Add a test case. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/17035 --- tests/chmod/c-option.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/chmod') diff --git a/tests/chmod/c-option.sh b/tests/chmod/c-option.sh index 1dd9b9ea7..a1782c3d8 100755 --- a/tests/chmod/c-option.sh +++ b/tests/chmod/c-option.sh @@ -37,4 +37,15 @@ case "$(cat out)" in *) cat out; fail=1 ;; esac +# From V5.1.0 to 8.22 this would stat the wrong file and +# give an erroneous ENOENT diagnostic +mkdir -p a/b || framework_failure_ +# chmod g+s might fail as detailed in setgid.sh +# but we don't care about those edge cases here +chmod g+s a/b +# This should never warn, but it did when special +# bits are set on b (the common case under test) +chmod -c -R g+w a 2>err +compare /dev/null err || fail=1 + Exit $fail -- cgit v1.2.3-54-g00ecf