2 # see if chgrp can change the group of a symlink
4 # Copyright (C) 2000, 2004-2007 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 <http://www.gnu.org/licenses/>.
19 if test "$VERBOSE" = yes; then
24 .
$srcdir/..
/group-names
25 .
$srcdir/..
/test-lib.sh
34 chgrp
-h $g2 symlink
2> /dev
/null
35 set _
`ls -ln symlink`
39 $0: skipping this test; your system doesn't support changing
40 the owner or group of a symbolic link.
48 set _
`ls -ln f`; g
=$5; test "$g" = $g1 || fail
=1
50 chgrp
-h $g2 symlink || fail
=1
51 set _
`ls -ln f`; g
=$5; test "$g" = $g1 || fail
=1
52 set _
`ls -ln symlink`; g
=$5; test "$g" = $g2 || fail
=1
54 # This should not change the group of f.
55 chgrp
-h $g2 symlink || fail
=1
56 set _
`ls -ln f`; g
=$5; test "$g" = $g1 || fail
=1
57 set _
`ls -ln symlink`; g
=$5; test "$g" = $g2 || fail
=1
60 set _
`ls -ln f`; g
=$5; test "$g" = $g2 || fail
=1
62 # This *should* change the group of f.
63 # Though note that the diagnostic you'd get with -c is misleading in that
64 # it says the `group of `symlink'' has been changed.
65 chgrp
--dereference $g1 symlink
66 set _
`ls -ln f`; g
=$5; test "$g" = $g1 || fail
=1
67 set _
`ls -ln symlink`; g
=$5; test "$g" = $g2 || fail
=1
69 (exit $fail); exit $fail