2000-04-27 14:30:59 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# verify that mkdir honors special bits in MODE
|
|
|
|
|
|
|
|
if test "$VERBOSE" = yes; then
|
|
|
|
set -x
|
2000-04-27 20:10:38 +08:00
|
|
|
mkdir --version
|
2000-04-27 14:30:59 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
tmp=mkdir-sp-$$
|
|
|
|
trap 'status=$?; rm -rf $tmp && exit $status' 0
|
|
|
|
trap 'exit $?' 1 2 13 15
|
|
|
|
|
2000-04-29 17:37:44 +08:00
|
|
|
set_mode_string=u=rwx,g=rx,o=w,go+t
|
|
|
|
output_mode_string=drwxr-x-wT
|
2000-04-27 14:36:05 +08:00
|
|
|
|
2000-04-29 17:37:44 +08:00
|
|
|
mkdir -m$set_mode_string $tmp || fail=1
|
2000-04-27 14:30:59 +08:00
|
|
|
|
|
|
|
test -d $tmp || fail=1
|
|
|
|
set -- `ls -ld $tmp`
|
|
|
|
case "$1" in
|
2000-04-29 17:37:44 +08:00
|
|
|
$output_mode_string) ;;
|
2000-04-27 14:30:59 +08:00
|
|
|
*) fail=1 ;;
|
|
|
|
esac
|
|
|
|
|
2000-04-27 14:34:07 +08:00
|
|
|
rmdir $tmp || fail=1
|
|
|
|
tmp2=$tmp/sub
|
|
|
|
|
|
|
|
# This should fail.
|
2000-04-29 17:37:44 +08:00
|
|
|
mkdir -m$set_mode_string $tmp2 2> /dev/null && fail=1
|
2000-04-27 14:34:07 +08:00
|
|
|
|
|
|
|
# Now test the --parents option.
|
2000-04-29 17:37:44 +08:00
|
|
|
mkdir --parents -m$set_mode_string $tmp2 || fail=1
|
2000-04-27 14:34:07 +08:00
|
|
|
|
|
|
|
test -d $tmp2 || fail=1
|
|
|
|
set -- `ls -ld $tmp2`
|
|
|
|
case "$1" in
|
2000-04-29 17:37:44 +08:00
|
|
|
$output_mode_string) ;;
|
2000-04-27 14:34:07 +08:00
|
|
|
*) fail=1 ;;
|
|
|
|
esac
|
|
|
|
|
2000-04-27 14:30:59 +08:00
|
|
|
exit $fail
|