Lines Matching +full:- +full:- +full:root
3 [ -f testing.sh ] && . testing.sh
5 if [ "$(id -u)" -ne 0 ]
7 echo "$SHOWSKIP: chgrp (not root)"
12 # We chgrp between "root" and the last group in /etc/group.
14 GRP="$(sed -n '$s/:.*//p' /etc/group)"
18 rm -rf testdir &&
19 mkdir -p testdir/dir/dir/dir testdir/dir2 &&
21 ln -s ../dir/dir testdir/dir2/dir &&
22 ln -s ../dir/file testdir/dir2/file || exit 1
26 IN="cd testdir && chgrp -R $GRP dir dir2 &&"
27 OUT="&& cd .. && echo \$(ls -lR testdir | awk '{print \$4}')"
35 testing "dir" "$IN chgrp root dir $OUT" \
36 "root $GRP $GRP $GRP $GRP $GRP $GRP\n" "" ""
37 testing "file" "$IN chgrp root dir/file $OUT" \
38 "$GRP $GRP $GRP root $GRP $GRP $GRP\n" "" ""
39 testing "dir and file" "$IN chgrp root dir dir/file $OUT" \
40 "root $GRP $GRP root $GRP $GRP $GRP\n" "" ""
43 testing "symlink->file" "$IN chgrp root dir2/file $OUT" \
44 "$GRP $GRP $GRP root $GRP $GRP $GRP\n" "" ""
45 testing "symlink->dir" "$IN chgrp root dir2/dir $OUT" \
46 "$GRP $GRP root $GRP $GRP $GRP $GRP\n" "" ""
47 testing "-h symlink->dir" "$IN chgrp -h root dir2/dir $OUT" \
48 "$GRP $GRP $GRP $GRP $GRP root $GRP\n" "" ""
50 # What does -h do (affect symlink, not target)
51 testing "-h symlink->file" "$IN chgrp -h root dir2/file $OUT" \
52 "$GRP $GRP $GRP $GRP $GRP $GRP root\n" "" ""
53 testing "-h symlink->dir" "$IN chgrp -h root dir2/dir $OUT" \
54 "$GRP $GRP $GRP $GRP $GRP root $GRP\n" "" ""
56 # chgrp -R (note, -h is implied by -R)
58 testing "-R dir" "$IN chgrp -R root dir $OUT" \
59 "root $GRP root root root $GRP $GRP\n" "" ""
60 testing "-R dir2" "$IN chgrp -R root dir2 $OUT" \
61 "$GRP root $GRP $GRP $GRP root root\n" "" ""
62 testing "-R symlink->dir" "$IN chgrp -R root dir2/dir $OUT" \
63 "$GRP $GRP $GRP $GRP $GRP root $GRP\n" "" ""
64 testing "-R symlink->file" "$IN chgrp -R root dir2/file $OUT" \
65 "$GRP $GRP $GRP $GRP $GRP $GRP root\n" "" ""
67 # chgrp -RP (same as -R by itself)
69 testing "-RP dir2" "$IN chgrp -RP root dir2 $OUT" \
70 "$GRP root $GRP $GRP $GRP root root\n" "" ""
71 testing "-RP symlink->dir" "$IN chgrp -RP root dir2/dir $OUT" \
72 "$GRP $GRP $GRP $GRP $GRP root $GRP\n" "" ""
73 testing "-RP symlink->file" "$IN chgrp -RP root dir2/file $OUT" \
74 "$GRP $GRP $GRP $GRP $GRP $GRP root\n" "" ""
76 # chgrp -RH (change target but only recurse through symlink->dir on cmdline)
78 testing "-RH dir2" "$IN chgrp -RH root dir2 $OUT" \
79 "$GRP root root root $GRP $GRP $GRP\n" "" ""
80 testing "-RH symlink->dir" "$IN chgrp -RH root dir2/dir $OUT" \
81 "$GRP $GRP root $GRP root $GRP $GRP\n" "" ""
82 testing "-RH symlink->file" "$IN chgrp -RH root dir2/file $OUT" \
83 "$GRP $GRP $GRP root $GRP $GRP $GRP\n" "" ""
85 # chgrp -RL (change target and always recurse through symlink->dir)
87 testing "-RL dir2" "$IN chgrp -RL root dir2 $OUT" \
88 "$GRP root root root root $GRP $GRP\n" "" ""
89 testing "-RL symlink->dir" "$IN chgrp -RL root dir2/dir $OUT" \
90 "$GRP $GRP root $GRP root $GRP $GRP\n" "" ""
91 testing "-RL symlink->file" "$IN chgrp -RL root dir2/file $OUT" \
92 "$GRP $GRP $GRP root $GRP $GRP $GRP\n" "" ""
94 # -HLP are NOPs without -R
95 testing "-H without -R" "$IN chgrp -H root dir2/dir $OUT" \
96 "$GRP $GRP root $GRP $GRP $GRP $GRP\n" "" ""
97 testing "-L without -R" "$IN chgrp -L root dir2/dir $OUT" \
98 "$GRP $GRP root $GRP $GRP $GRP $GRP\n" "" ""
99 testing "-P without -R" "$IN chgrp -P root dir2/dir $OUT" \
100 "$GRP $GRP root $GRP $GRP $GRP $GRP\n" "" ""
102 rm -rf testdir