6ed95b12278fd2e9e863c3bb09167715579f13a3
[platform/upstream/coreutils.git] / tests / chmod / umask-x
1 #!/bin/sh
2 # Test that chmod -x file reports an error if the result is executable.
3
4 if test "$VERBOSE" = yes; then
5   set -x
6   chmod --version
7 fi
8
9 . $srcdir/../lang-default
10
11 pwd=`pwd`
12 tmp=minus.$$
13 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
14 trap '(exit $?); exit' 1 2 13 15
15
16 framework_failure=0
17 mkdir $tmp || framework_failure=1
18 cd $tmp || framework_failure=1
19
20 if test $framework_failure = 1; then
21   echo "$0: failure in testing framework" 1>&2
22   (exit 1); exit 1
23 fi
24
25 fail=0
26
27 touch file
28 chmod 755 file
29 (umask 77 && chmod -x file) 2>/dev/null && fail=1
30
31 if test $framework_failure = 1; then
32   echo "$0: failure in testing framework" 1>&2
33   fail=1
34 fi
35
36 (exit $fail); exit $fail