• Home
  • Raw
  • Download

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.
13 GRP="$(sed -n '$s/:.*//p' /etc/group)"
14 # Or if that fails, assume we're on Android and pick a well-known group.
19 rm -rf testdir &&
20 mkdir -p testdir/dir/dir/dir testdir/dir2 &&
22 ln -s ../dir/dir testdir/dir2/dir &&
23 ln -s ../dir/file testdir/dir2/file || exit 1
27 IN="cd testdir && chgrp -R $GRP dir dir2 &&"
28 OUT="&& cd .. && echo \$(ls -lR testdir | awk '{print \$4}')"
36 testing "dir" "$IN chgrp root dir $OUT" \
37 "root $GRP $GRP $GRP $GRP $GRP $GRP\n" "" ""
38 testing "file" "$IN chgrp root dir/file $OUT" \
39 "$GRP $GRP $GRP root $GRP $GRP $GRP\n" "" ""
40 testing "dir and file" "$IN chgrp root dir dir/file $OUT" \
41 "root $GRP $GRP root $GRP $GRP $GRP\n" "" ""
44 testing "symlink->file" "$IN chgrp root dir2/file $OUT" \
45 "$GRP $GRP $GRP root $GRP $GRP $GRP\n" "" ""
46 testing "symlink->dir" "$IN chgrp root dir2/dir $OUT" \
47 "$GRP $GRP root $GRP $GRP $GRP $GRP\n" "" ""
48 testing "-h symlink->dir" "$IN chgrp -h root dir2/dir $OUT" \
49 "$GRP $GRP $GRP $GRP $GRP root $GRP\n" "" ""
51 # What does -h do (affect symlink, not target)
52 testing "-h symlink->file" "$IN chgrp -h root dir2/file $OUT" \
53 "$GRP $GRP $GRP $GRP $GRP $GRP root\n" "" ""
54 testing "-h symlink->dir" "$IN chgrp -h root dir2/dir $OUT" \
55 "$GRP $GRP $GRP $GRP $GRP root $GRP\n" "" ""
57 # chgrp -R (note, -h is implied by -R)
59 testing "-R dir" "$IN chgrp -R root dir $OUT" \
60 "root $GRP root root root $GRP $GRP\n" "" ""
61 testing "-R dir2" "$IN chgrp -R root dir2 $OUT" \
62 "$GRP root $GRP $GRP $GRP root root\n" "" ""
63 testing "-R symlink->dir" "$IN chgrp -R root dir2/dir $OUT" \
64 "$GRP $GRP $GRP $GRP $GRP root $GRP\n" "" ""
65 testing "-R symlink->file" "$IN chgrp -R root dir2/file $OUT" \
66 "$GRP $GRP $GRP $GRP $GRP $GRP root\n" "" ""
68 # chgrp -RP (same as -R by itself)
70 testing "-RP dir2" "$IN chgrp -RP root dir2 $OUT" \
71 "$GRP root $GRP $GRP $GRP root root\n" "" ""
72 testing "-RP symlink->dir" "$IN chgrp -RP root dir2/dir $OUT" \
73 "$GRP $GRP $GRP $GRP $GRP root $GRP\n" "" ""
74 testing "-RP symlink->file" "$IN chgrp -RP root dir2/file $OUT" \
75 "$GRP $GRP $GRP $GRP $GRP $GRP root\n" "" ""
77 # chgrp -RH (change target but only recurse through symlink->dir on cmdline)
79 testing "-RH dir2" "$IN chgrp -RH root dir2 $OUT" \
80 "$GRP root root root $GRP $GRP $GRP\n" "" ""
81 testing "-RH symlink->dir" "$IN chgrp -RH root dir2/dir $OUT" \
82 "$GRP $GRP root $GRP root $GRP $GRP\n" "" ""
83 testing "-RH symlink->file" "$IN chgrp -RH root dir2/file $OUT" \
84 "$GRP $GRP $GRP root $GRP $GRP $GRP\n" "" ""
86 # chgrp -RL (change target and always recurse through symlink->dir)
88 testing "-RL dir2" "$IN chgrp -RL root dir2 $OUT" \
89 "$GRP root root root root $GRP $GRP\n" "" ""
90 testing "-RL symlink->dir" "$IN chgrp -RL root dir2/dir $OUT" \
91 "$GRP $GRP root $GRP root $GRP $GRP\n" "" ""
92 testing "-RL symlink->file" "$IN chgrp -RL root dir2/file $OUT" \
93 "$GRP $GRP $GRP root $GRP $GRP $GRP\n" "" ""
95 # -HLP are NOPs without -R
96 testing "-H without -R" "$IN chgrp -H root dir2/dir $OUT" \
97 "$GRP $GRP root $GRP $GRP $GRP $GRP\n" "" ""
98 testing "-L without -R" "$IN chgrp -L root dir2/dir $OUT" \
99 "$GRP $GRP root $GRP $GRP $GRP $GRP\n" "" ""
100 testing "-P without -R" "$IN chgrp -P root dir2/dir $OUT" \
101 "$GRP $GRP root $GRP $GRP $GRP $GRP\n" "" ""
103 rm -rf testdir