2 # Verify that chmod works correctly with odd option combinations.
4 if test "$VERBOSE" = yes; then
9 . $srcdir/../lang-default
12 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
13 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
14 trap '(exit $?); exit $?' 1 2 13 15
17 mkdir -p $tmp || framework_failure=1
18 cd $tmp || framework_failure=1
20 if test $framework_failure = 1; then
21 echo "$0: failure in testing framework" 1>&2
27 # Each line in this list is a set of arguments, followed by :,
28 # followed by the set of files it will attempt to chmod,
29 # or empty if the usage is erroneous.
30 # Many of these test cases are due to Glenn Fowler.
31 # These test cases assume GNU behavior for "options" like -w.
61 all_files=`echo "$cases" | sed 's/.*://'|sort -u`
66 for case in $cases; do
68 args=`expr "$case" : ' *\(.*[^ ]\) *:'`
69 files=`expr "$case" : '.*: *\(.*\)'`
73 touch -- $all_files || framework_failure=1
74 chmod $args 2>/dev/null && fail=1
77 touch -- $files || framework_failure=1
79 for file in $files; do
80 # Test for misparsing args by creating all $files but $file.
81 # chmod has a bug if it succeeds even though $file is absent.
82 rm -f -- $all_files && touch -- $files && rm -- $file \
83 || framework_failure=1
84 chmod $args 2>/dev/null && fail=1
90 if test $framework_failure = 1; then
91 echo "$0: failure in testing framework" 1>&2
95 (exit $fail); exit $fail