1#!/bin/sh 2# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/05.t 211352 2010-08-15 21:24:17Z pjd $ 3 4desc="chmod returns EACCES when search permission is denied for a component of the path prefix" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9if supported lchmod; then 10 echo "1..19" 11else 12 echo "1..14" 13fi 14 15n0=`namegen` 16n1=`namegen` 17n2=`namegen` 18 19expect 0 mkdir ${n0} 0755 20cdir=`pwd` 21cd ${n0} 22expect 0 mkdir ${n1} 0755 23expect 0 chown ${n1} 65534 65534 24expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644 25expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0642 26expect 0642 -u 65534 -g 65534 stat ${n1}/${n2} mode 27expect 0 chmod ${n1} 0644 28expect EACCES -u 65534 -g 65534 chmod ${n1}/${n2} 0620 29expect 0 chmod ${n1} 0755 30expect 0 -u 65534 -g 65534 chmod ${n1}/${n2} 0420 31expect 0420 -u 65534 -g 65534 stat ${n1}/${n2} mode 32if supported lchmod; then 33 expect 0 chmod ${n1} 0644 34 expect EACCES -u 65534 -g 65534 lchmod ${n1}/${n2} 0410 35 expect 0 chmod ${n1} 0755 36 expect 0 -u 65534 -g 65534 lchmod ${n1}/${n2} 0710 37 expect 0710 -u 65534 -g 65534 stat ${n1}/${n2} mode 38fi 39expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} 40expect 0 rmdir ${n1} 41cd ${cdir} 42expect 0 rmdir ${n0} 43