]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Use chown --from to discover whether the
authorJim Meyering <jim@meyering.net>
Tue, 8 Jun 2004 15:25:45 +0000 (15:25 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 8 Jun 2004 15:25:45 +0000 (15:25 +0000)
group changed, since chgrp now changes unconditionally.  This
complicates the sed script a bit.  Do not specify --dereference,
since it's the default (and we want to test this).  Adjust output
to match the fact that chgrp no longer optimizes the case of
changing a file's group to the same value as before.

tests/chgrp/basic

index aaa0f9478e107b5c0af68578e414c6bef5836446..d5f8c76dcf220bac569e571cc0aa1d31698d4458 100755 (executable)
@@ -60,32 +60,36 @@ test "$VERBOSE" = yes && set +x
 
   # This should not change the group of f.
   chgrp -h -c $g2 symlink 2> /dev/null
-  chgrp -c $g2 f
+  chown --from=:$g1 -c :$g2 f
 
   # This *should* change the group of f.
   # Though note that the diagnostic is misleading in that
   # it says the `group of `symlink'' has been changed.
-  chgrp --dereference -c $g1 symlink
+  chgrp -c $g1 symlink
+  chown --from=:$g1 -c :$g2 f
 
-) 2>&1 | sed "s/ $g1$/ G1/;s/ $g2$/ G2/" > actual
+) 2>&1 | sed "s/\([ :]\)$g1$/\1G1/;s/\([ :]\)$g2$/\1G2/" > actual
 
 cat <<\EOF > expected
 changed group of `f' to G1
 changed group of `f' to G2
+changed group of `f' to G2
+changed group of `f' to G1
 changed group of `f' to G1
-group of `f' retained as G1
 changed group of `f' to G2
-changed group of `d' to G2
 changed group of `d/f3' to G2
-changed group of `d' to G1
-changed group of `d/f3' to G1
 changed group of `d' to G2
-changed group of `d/f3' to G2
+changed group of `d/f3' to G1
 changed group of `d' to G1
+changed group of `d/f3' to G2
+changed group of `d' to G2
 changed group of `d/f3' to G1
+changed group of `d' to G1
 changed group of `d' to G2
-changed group of `f' to G2
+changed group of `symlink' to G2
+changed ownership of `f' to :G2
 changed group of `symlink' to G1
+changed ownership of `f' to :G2
 EOF
 
 cmp expected actual \