From b10a836fa0f27b5f2ef1491c3226681a97ea4072 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 17 Jan 2005 22:40:57 +0000 Subject: Use numeric group ids, not symbolic group names, to avoid shell quoting issues. --- tests/chgrp/basic | 8 ++++++-- tests/chgrp/deref | 18 +++++++++--------- tests/chgrp/posix-H | 4 ++-- tests/chgrp/recurse | 10 +++++----- tests/group-names | 2 +- 5 files changed, 23 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/chgrp/basic b/tests/chgrp/basic index de3d1aef0..de43573ba 100755 --- a/tests/chgrp/basic +++ b/tests/chgrp/basic @@ -84,7 +84,11 @@ test "$VERBOSE" = yes && set +x chgrp '' f ls -c -t f g -) 2>&1 | sed "s/\([ :]\)$g1$/\1G1/;s/\([ :]\)$g2$/\1G2/" > actual +) 2>&1 | sed " + s/' to .*[^0-9:].*/' to SOMENAME/ + s/\([ :]\)$g1$/\1G1/ + s/\([ :]\)$g2$/\1G2/ +" > actual cat <<\EOF > expected changed group of `f' to G1 @@ -92,7 +96,7 @@ changed group of `f' to G2 ownership of `f' retained changed group of `f' to G1 group of `f' retained as G1 -changed group of `f' to G2 +changed group of `f' to SOMENAME changed group of `d/f3' to G2 changed group of `d' to G2 changed group of `d/f3' to G1 diff --git a/tests/chgrp/deref b/tests/chgrp/deref index 5e605bfa6..ff215125c 100755 --- a/tests/chgrp/deref +++ b/tests/chgrp/deref @@ -30,7 +30,7 @@ touch f ln -s f symlink chgrp -h $g2 symlink 2> /dev/null -set _ `ls -l symlink` +set _ `ls -ln symlink` g=$5 test "$g" = $g2 || { cat <&2 @@ -43,25 +43,25 @@ EOF fail=0 chgrp $g1 f -set _ `ls -l f`; g=$5; test "$g" = $g1 || fail=1 +set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1 chgrp -h $g2 symlink || fail=1 -set _ `ls -l f`; g=$5; test "$g" = $g1 || fail=1 -set _ `ls -l symlink`; g=$5; test "$g" = $g2 || fail=1 +set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1 +set _ `ls -ln symlink`; g=$5; test "$g" = $g2 || fail=1 # This should not change the group of f. chgrp -h $g2 symlink || fail=1 -set _ `ls -l f`; g=$5; test "$g" = $g1 || fail=1 -set _ `ls -l symlink`; g=$5; test "$g" = $g2 || fail=1 +set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1 +set _ `ls -ln symlink`; g=$5; test "$g" = $g2 || fail=1 chgrp $g2 f -set _ `ls -l f`; g=$5; test "$g" = $g2 || fail=1 +set _ `ls -ln f`; g=$5; test "$g" = $g2 || fail=1 # This *should* change the group of f. # Though note that the diagnostic you'd get with -c is misleading in that # it says the `group of `symlink'' has been changed. chgrp --dereference $g1 symlink -set _ `ls -l f`; g=$5; test "$g" = $g1 || fail=1 -set _ `ls -l symlink`; g=$5; test "$g" = $g2 || fail=1 +set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1 +set _ `ls -ln symlink`; g=$5; test "$g" = $g2 || fail=1 (exit $fail); exit $fail diff --git a/tests/chgrp/posix-H b/tests/chgrp/posix-H index 92a2cd0c0..e9736968d 100755 --- a/tests/chgrp/posix-H +++ b/tests/chgrp/posix-H @@ -48,7 +48,7 @@ for i in $changed; do # Filter out symlinks (entries that end in `s'), since it's not # possible to change their group/owner information on some systems. case $i in *s) continue;; esac - set _ `ls -dg $i`; shift + set _ `ls -dgn $i`; shift group=$3 test $group = $g2 || fail=1 done @@ -64,7 +64,7 @@ for i in $not_changed; do # Filter out symlinks (entries that end in `s'), since it's not # possible to change their group/owner information on some systems. case $i in *s) continue;; esac - set _ `ls -dg $i`; shift + set _ `ls -dgn $i`; shift group=$3 test $group = $g1 || fail=1 done diff --git a/tests/chgrp/recurse b/tests/chgrp/recurse index 05aaa08d4..7cd1648e2 100755 --- a/tests/chgrp/recurse +++ b/tests/chgrp/recurse @@ -35,22 +35,22 @@ ln -s ../e d/s chgrp -R $g1 e/ee || fail=1 # This should not should change the group of e/ee chgrp -R $g2 d -set _ `ls -l e/ee`; g=$5; test "$g" = $g1 || fail=1 +set _ `ls -ln e/ee`; g=$5; test "$g" = $g1 || fail=1 # This must change the group of e/ee, since -L makes # chgrp traverse the symlink from d/s into e. chgrp -L -R $g2 d -set _ `ls -l e/ee`; g=$5; test "$g" = $g2 || fail=1 +set _ `ls -ln e/ee`; g=$5; test "$g" = $g2 || fail=1 # This must *not* change the group of e/ee chgrp -H -R $g1 d -set _ `ls -l e/ee`; g=$5; test "$g" = $g2 || fail=1 +set _ `ls -ln e/ee`; g=$5; test "$g" = $g2 || fail=1 ln -s d link # This shouldn't change the group of e/ee either. chgrp -H -R $g1 link || fail=1 -set _ `ls -l e/ee`; g=$5; test "$g" = $g2 || fail=1 +set _ `ls -ln e/ee`; g=$5; test "$g" = $g2 || fail=1 # But it *should* change d/dd. -set _ `ls -l d/dd`; g=$5; test "$g" = $g1 || fail=1 +set _ `ls -ln d/dd`; g=$5; test "$g" = $g1 || fail=1 (exit $fail); exit $fail diff --git a/tests/group-names b/tests/group-names index 5dae7943a..2bd22b42d 100644 --- a/tests/group-names +++ b/tests/group-names @@ -2,7 +2,7 @@ # Set `groups' to a space-separated list of at least two groups of which # the user is a member. -groups=${FETISH_GROUPS-`(id -nG || /usr/xpg4/bin/id -nG) 2>/dev/null`} +groups=${FETISH_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2>/dev/null`} case "$groups" in *' '*) ;; *) cat <&2 -- cgit v1.2.3-70-g09d2