1271294Sngie#!/bin/sh 2271294Sngie# $FreeBSD: head/tools/regression/pjdfstest/tests/link/13.t 211352 2010-08-15 21:24:17Z pjd $ 3271294Sngie 4271294Sngiedesc="link returns EPERM if the parent directory of the destination file has its immutable flag set" 5271294Sngie 6271294Sngiedir=`dirname $0` 7271294Sngie. ${dir}/../misc.sh 8271294Sngie 9271294Sngierequire chflags 10271294Sngie 11271294Sngiecase "${os}:${fs}" in 12271294SngieFreeBSD:ZFS) 13271294Sngie echo "1..29" 14271294Sngie ;; 15271294SngieFreeBSD:UFS) 16271294Sngie echo "1..49" 17271294Sngie ;; 18271294Sngie*) 19271294Sngie quick_exit 20271294Sngieesac 21271294Sngie 22271294Sngien0=`namegen` 23271294Sngien1=`namegen` 24271294Sngien2=`namegen` 25271294Sngie 26271294Sngieexpect 0 mkdir ${n0} 0755 27271294Sngie 28271294Sngieexpect 0 create ${n0}/${n1} 0644 29271294Sngieexpect 1 stat ${n0}/${n1} nlink 30271294Sngieexpect 0 link ${n0}/${n1} ${n0}/${n2} 31271294Sngieexpect 2 stat ${n0}/${n1} nlink 32271294Sngieexpect 0 unlink ${n0}/${n2} 33271294Sngieexpect 1 stat ${n0}/${n1} nlink 34271294Sngie 35271294Sngieexpect 0 chflags ${n0} SF_IMMUTABLE 36271294Sngieexpect EPERM link ${n0}/${n1} ${n0}/${n2} 37271294Sngieexpect 1 stat ${n0}/${n1} nlink 38271294Sngieexpect 0 chflags ${n0} none 39271294Sngieexpect 0 link ${n0}/${n1} ${n0}/${n2} 40271294Sngieexpect 2 stat ${n0}/${n1} nlink 41271294Sngieexpect 0 unlink ${n0}/${n2} 42271294Sngieexpect 1 stat ${n0}/${n1} nlink 43271294Sngie 44271294Sngieexpect 0 chflags ${n0} SF_NOUNLINK 45271294Sngieexpect 0 link ${n0}/${n1} ${n0}/${n2} 46271294Sngieexpect 2 stat ${n0}/${n1} nlink 47271294Sngieexpect 0 chflags ${n0} none 48271294Sngieexpect 0 unlink ${n0}/${n2} 49271294Sngieexpect 1 stat ${n0}/${n1} nlink 50271294Sngie 51271294Sngieexpect 0 chflags ${n0} SF_APPEND 52271294Sngieexpect 0 link ${n0}/${n1} ${n0}/${n2} 53271294Sngieexpect 2 stat ${n0}/${n1} nlink 54271294Sngieexpect 0 chflags ${n0} none 55271294Sngieexpect 0 unlink ${n0}/${n2} 56271294Sngieexpect 1 stat ${n0}/${n1} nlink 57271294Sngie 58271294Sngiecase "${os}:${fs}" in 59271294SngieFreeBSD:UFS) 60271294Sngie expect 0 chflags ${n0} UF_IMMUTABLE 61271294Sngie expect EPERM link ${n0}/${n1} ${n0}/${n2} 62271294Sngie expect 1 stat ${n0}/${n1} nlink 63271294Sngie expect 0 chflags ${n0} none 64271294Sngie expect 0 link ${n0}/${n1} ${n0}/${n2} 65271294Sngie expect 2 stat ${n0}/${n1} nlink 66271294Sngie expect 0 unlink ${n0}/${n2} 67271294Sngie expect 1 stat ${n0}/${n1} nlink 68271294Sngie 69271294Sngie expect 0 chflags ${n0} UF_NOUNLINK 70271294Sngie expect 0 link ${n0}/${n1} ${n0}/${n2} 71271294Sngie expect 2 stat ${n0}/${n1} nlink 72271294Sngie expect 0 chflags ${n0} none 73271294Sngie expect 0 unlink ${n0}/${n2} 74271294Sngie expect 1 stat ${n0}/${n1} nlink 75271294Sngie 76271294Sngie expect 0 chflags ${n0} UF_APPEND 77271294Sngie expect 0 link ${n0}/${n1} ${n0}/${n2} 78271294Sngie expect 2 stat ${n0}/${n1} nlink 79271294Sngie expect 0 chflags ${n0} none 80271294Sngie expect 0 unlink ${n0}/${n2} 81271294Sngie expect 1 stat ${n0}/${n1} nlink 82271294Sngie ;; 83271294Sngieesac 84271294Sngie 85271294Sngieexpect 0 unlink ${n0}/${n1} 86271294Sngieexpect 0 rmdir ${n0} 87