xref: /freebsd/contrib/pjdfstest/tests/chflags/05.t (revision 2008043f386721d58158e37e0d7e50df8095942d)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/05.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="chflags returns EACCES when search permission is denied for a component of the path prefix"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10require chflags
11
12echo "1..16"
13
14n0=`namegen`
15n1=`namegen`
16n2=`namegen`
17
18expect 0 mkdir ${n0} 0755
19cdir=`pwd`
20cd ${n0}
21expect 0 mkdir ${n1} 0755
22expect 0 chown ${n1} 65534 65534
23expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
24expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP
25expect UF_NODUMP -u 65534 -g 65534 stat ${n1}/${n2} flags
26expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none
27expect 0 chmod ${n1} 0644
28expect EACCES -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP
29expect 0 chmod ${n1} 0755
30expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP
31expect UF_NODUMP -u 65534 -g 65534 stat ${n1}/${n2} flags
32expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none
33expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
34expect 0 rmdir ${n1}
35cd ${cdir}
36expect 0 rmdir ${n0}
37