diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/chown/preserve-root | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/chown/preserve-root b/tests/chown/preserve-root index 152f59c30..4f8fe4f7f 100755 --- a/tests/chown/preserve-root +++ b/tests/chown/preserve-root @@ -55,6 +55,18 @@ chgrp -R --preserve-root 0 / >> out 2>&1 && fail=1 # and then, only to make them readable by owner. chmod -R --preserve-root u+r / >> out 2>&1 && fail=1 +# With -RHh, --preserve-root should trigger nothing, +# since the symlink in question is not a command line argument. +# Contrary to the above commands, these two should succeed. +echo '==== test -RHh' >> out +chown -RHh --preserve-root `id -u` d >> out 2>&1 || fail=1 +chgrp -RHh --preserve-root `id -g` d >> out 2>&1 || fail=1 + +# These must fail. +echo '==== test -RLh' >> out +chown -RLh --preserve-root `id -u` d >> out 2>&1 && fail=1 +chgrp -RLh --preserve-root `id -g` d >> out 2>&1 && fail=1 + cat <<\EOF > exp || fail=1 chown: it is dangerous to operate recursively on `/' chown: use --no-preserve-root to override this failsafe @@ -62,6 +74,12 @@ chgrp: it is dangerous to operate recursively on `/' chgrp: use --no-preserve-root to override this failsafe chmod: it is dangerous to operate recursively on `/' chmod: use --no-preserve-root to override this failsafe +==== test -RHh +==== test -RLh +chown: it is dangerous to operate recursively on `d/slink-to-root' (same as `/') +chown: use --no-preserve-root to override this failsafe +chgrp: it is dangerous to operate recursively on `d/slink-to-root' (same as `/') +chgrp: use --no-preserve-root to override this failsafe EOF cmp out exp || fail=1 |