2 # Make sure GNU chmod works the same way as those of Solaris, HPUX, AIX
3 # on directories with the setgid bit set. Also, check that the GNU octal
6 # Copyright (C) 2001-2019 Free Software Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
25 mkdir
-m 755 d || framework_failure_
27 chmod g
+s d
2> /dev
/null
&& env
-- test -g d ||
29 # This is required because on some systems (at least NetBSD 1.4.2A),
30 # it may happen that when you create a directory, its group isn't one
31 # to which you belong. When that happens, the above chmod fails. So
32 # here, upon failure, we try to set the group, then rerun the chmod command.
37 chmod g
+s d || framework_failure_
40 # "chmod g+s d" does nothing on some NFS file systems.
42 skip_
'cannot create setgid directories'
45 + - g-s
00755 000755 =755 -2000 -7022 755 0755 \
46 +2000 -5022 =7777,-5022
48 chmod $mode d || fail
=1
51 g-s |
00*755 |
=755 |
-2000 |
-7022)
52 expected_mode
=drwxr-xr-x
;;
53 *) expected_mode
=drwxr-sr-x
;;
61 chmod =2755 d || fail
=1