summaryrefslogtreecommitdiff
path: root/tests/chgrp
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-06-08 16:58:28 +0000
committerJim Meyering <jim@meyering.net>2004-06-08 16:58:28 +0000
commit57a06c936605bf64cf519487e7c2c02b889b5e8f (patch)
tree878918e6ca2c849d2d44d3f07223ab354835cf83 /tests/chgrp
parent4925135810420398c46635561d52944cb2760c83 (diff)
downloadcoreutils-57a06c936605bf64cf519487e7c2c02b889b5e8f.tar.xz
Test that chgrp -h does not fail on
symlinks, even on hosts where that's not supported. Test that if -R is specified without -H or L, -h is assumed. Test that chown() is not optimized away.
Diffstat (limited to 'tests/chgrp')
-rwxr-xr-xtests/chgrp/basic21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/chgrp/basic b/tests/chgrp/basic
index d5f8c76dc..371e17386 100755
--- a/tests/chgrp/basic
+++ b/tests/chgrp/basic
@@ -56,10 +56,10 @@ test "$VERBOSE" = yes && set +x
touch f
ln -s f symlink
chgrp $g1 f
- chgrp -h $g2 symlink 2> /dev/null
+ chgrp -h $g2 symlink
# This should not change the group of f.
- chgrp -h -c $g2 symlink 2> /dev/null
+ chgrp -h -c $g2 symlink
chown --from=:$g1 -c :$g2 f
# This *should* change the group of f.
@@ -68,6 +68,20 @@ test "$VERBOSE" = yes && set +x
chgrp -c $g1 symlink
chown --from=:$g1 -c :$g2 f
+ # If -R is specified without -H or L, -h is assumed.
+ chgrp -h $g1 f symlink
+ chgrp -R $g2 symlink
+ chown --from=:$g1 -c :$g2 f
+
+ # chown() must not be optimized away even when
+ # the file's owner and group already have the desired value.
+ touch f g
+ chgrp $g1 f g
+ chgrp $g2 g
+ sleep 1
+ chgrp $g1 f
+ ls -c -t f g
+
) 2>&1 | sed "s/\([ :]\)$g1$/\1G1/;s/\([ :]\)$g2$/\1G2/" > actual
cat <<\EOF > expected
@@ -90,6 +104,9 @@ changed group of `symlink' to G2
changed ownership of `f' to :G2
changed group of `symlink' to G1
changed ownership of `f' to :G2
+changed ownership of `f' to :G2
+f
+g
EOF
cmp expected actual \