2 # Verify that chmod's --changes (-c) option works.
4 # Copyright (C) 2000-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
24 touch $file || framework_failure_
25 chmod 444 $file || framework_failure_
30 chmod u
=rwx
$file || fail
=1
31 chmod -c g
=rwx
$file > out || fail
=1
32 chmod -c g
=rwx
$file > empty || fail
=1
34 compare
/dev
/null empty || fail
=1
36 "mode of 'f' changed from 0744 "?rwxr--r--?
" to 0774 "?rwxrwxr--?
) ;;
40 # From V5.1.0 to 8.22 this would stat the wrong file and
41 # give an erroneous ENOENT diagnostic
42 mkdir
-p a
/b || framework_failure_
43 # chmod g+s might fail as detailed in setgid.sh
44 # but we don't care about those edge cases here
46 # This should never warn, but it did when special
47 # bits are set on b (the common case under test)
48 chmod -c -R g
+w a
2>err
49 compare
/dev
/null err || fail
=1