Various cleanups, mostly to make the test work on FreeBSD/ZFS.

This commit is contained in:
Pawel Jakub Dawidek 2010-08-06 23:58:54 +00:00
parent 34622ff1ab
commit 6a8ecf4c59
48 changed files with 1245 additions and 896 deletions

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..40"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..22"
;;
FreeBSD:UFS)
echo "1..44"
;;
*)
quick_exit
esac
n0=`namegen`
@ -18,30 +27,7 @@ expect EPERM chmod ${n0} 0600
expect 0644 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 chmod ${n0} 0600
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM chmod ${n0} 0600
expect 0644 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 chmod ${n0} 0600
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_APPEND
expect EPERM chmod ${n0} 0600
expect 0644 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 chmod ${n0} 0600
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM chmod ${n0} 0600
expect 0644 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 chmod ${n0} 0600
expect 0600 stat ${n0} mode
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
@ -51,9 +37,50 @@ expect 0600 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 chmod ${n0} 0600
expect 0600 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
case "${os}:${fs}" in
FreeBSD:ZFS)
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_APPEND
expect 0 chmod ${n0} 0600
expect 0600 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 chmod ${n0} 0600
expect 0600 stat ${n0} mode
expect 0 unlink ${n0}
;;
FreeBSD:UFS)
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_APPEND
expect EPERM chmod ${n0} 0600
expect 0644 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 chmod ${n0} 0600
expect 0600 stat ${n0} mode
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM chmod ${n0} 0600
expect 0644 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 chmod ${n0} 0600
expect 0600 stat ${n0} mode
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 chmod ${n0} 0600
expect 0600 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM chmod ${n0} 0600
expect 0644 stat ${n0} mode
expect 0 chflags ${n0} none
expect 0 chmod ${n0} 0600
expect 0600 stat ${n0} mode
expect 0 unlink ${n0}
;;
esac

View File

@ -6,32 +6,27 @@ desc="chmod returns EROFS if the named file resides on a read-only file system"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..10"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..10"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 chmod ${n0}/${n1} 0640
expect 0640 stat ${n0}/${n1} mode
mount -ur /dev/md${n}
expect EROFS chmod ${n0}/${n1} 0600
expect 0640 stat ${n0}/${n1} mode
mount -uw /dev/md${n}
expect 0 chmod ${n0}/${n1} 0600
expect 0600 stat ${n0}/${n1} mode
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 chmod ${n0}/${n1} 0640
expect 0640 stat ${n0}/${n1} mode
mount -ur /dev/md${n}
expect EROFS chmod ${n0}/${n1} 0600
expect 0640 stat ${n0}/${n1} mode
mount -uw /dev/md${n}
expect 0 chmod ${n0}/${n1} 0600
expect 0600 stat ${n0}/${n1} mode
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -8,46 +8,77 @@ dir=`dirname $0`
require chflags
echo "1..34"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..20"
;;
FreeBSD:UFS)
echo "1..44"
;;
*)
quick_exit
esac
n0=`namegen`
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_IMMUTABLE
expect EPERM chown ${n0} 65534 65534
expect 0,0 stat ${n0} uid,gid
expect 0 chflags ${n0} none
expect 0 chown ${n0} 65534 65534
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM chown ${n0} 65534 65534
expect 0 chflags ${n0} none
expect 0 chown ${n0} 65534 65534
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_APPEND
expect EPERM chown ${n0} 65534 65534
expect 0 chflags ${n0} none
expect 0 chown ${n0} 65534 65534
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM chown ${n0} 65534 65534
expect 0 chflags ${n0} none
expect 0 chown ${n0} 65534 65534
expect 65534,65534 stat ${n0} uid,gid
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 chown ${n0} 65534 65534
expect 65534,65534 stat ${n0} uid,gid
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 chown ${n0} 65534 65534
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
case "${os}:${fs}" in
FreeBSD:ZFS)
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_APPEND
expect 0 chown ${n0} 65534 65534
expect 65534,65534 stat ${n0} uid,gid
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
;;
FreeBSD:UFS)
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_APPEND
expect EPERM chown ${n0} 65534 65534
expect 0,0 stat ${n0} uid,gid
expect 0 chflags ${n0} none
expect 0 chown ${n0} 65534 65534
expect 65534,65534 stat ${n0} uid,gid
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM chown ${n0} 65534 65534
expect 0,0 stat ${n0} uid,gid
expect 0 chflags ${n0} none
expect 0 chown ${n0} 65534 65534
expect 65534,65534 stat ${n0} uid,gid
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 chown ${n0} 65534 65534
expect 65534,65534 stat ${n0} uid,gid
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM chown ${n0} 65534 65534
expect 0,0 stat ${n0} uid,gid
expect 0 chflags ${n0} none
expect 0 chown ${n0} 65534 65534
expect 65534,65534 stat ${n0} uid,gid
expect 0 unlink ${n0}
;;
esac

View File

@ -6,32 +6,27 @@ desc="chown returns EROFS if the named file resides on a read-only file system"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:{fs}" in
FreeBSD:UFS)
echo "1..10"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..10"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 chown ${n0}/${n1} 65534 65534
expect 65534,65534 stat ${n0}/${n1} uid,gid
mount -ur /dev/md${n}
expect EROFS chown ${n0}/${n1} 65533 65533
expect 65534,65534 stat ${n0}/${n1} uid,gid
mount -uw /dev/md${n}
expect 0 chown ${n0}/${n1} 65533 65533
expect 65533,65533 stat ${n0}/${n1} uid,gid
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 chown ${n0}/${n1} 65534 65534
expect 65534,65534 stat ${n0}/${n1} uid,gid
mount -ur /dev/md${n}
expect EROFS chown ${n0}/${n1} 65533 65533
expect 65534,65534 stat ${n0}/${n1} uid,gid
mount -uw /dev/md${n}
expect 0 chown ${n0}/${n1} 65533 65533
expect 65533,65533 stat ${n0}/${n1} uid,gid
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,6 +6,8 @@ desc="NFSv4 granular permissions checking - WRITE_DATA vs APPEND_DATA on directo
dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit
echo "1..49"
n0=`namegen`

View File

@ -6,6 +6,8 @@ desc="NFSv4 granular permissions checking - ACL_READ_ATTRIBUTES and ACL_WRITE_AT
dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit
echo "1..12"
n0=`namegen`

View File

@ -6,6 +6,8 @@ desc="NFSv4 granular permissions checking - ACL_READ_ACL and ACL_WRITE_ACL"
dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit
echo "1..83"
n0=`namegen`

View File

@ -6,6 +6,8 @@ desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD"
dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit
echo "1..65"
n0=`namegen`

View File

@ -6,6 +6,8 @@ desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER"
dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit
echo "1..52"
n0=`namegen`

View File

@ -6,6 +6,8 @@ desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD with directo
dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit
echo "1..68"
n0=`namegen`

View File

@ -6,36 +6,31 @@ desc="link returns EMLINK if the link count of the file named by name1 would exc
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..5"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
n2=`namegen`
echo "1..5"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs -i 1 /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
i=1
while :; do
link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
test_check $i -eq 32767
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect EMLINK link ${n0}/${n1} ${n0}/${n2}
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs -i 1 /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
i=1
while :; do
link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
test_check $i -eq 32767
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
expect EMLINK link ${n0}/${n1} ${n0}/${n2}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -8,48 +8,88 @@ dir=`dirname $0`
require chflags
echo "1..32"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..27"
;;
FreeBSD:UFS)
echo "1..48"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
expect 0 create ${n0} 0644
expect 1 stat ${n0} nlink
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} SF_IMMUTABLE
todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM."
expect EPERM link ${n0} ${n1}
todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM."
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} none
todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM."
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 unlink ${n1}
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM link ${n0} ${n1}
expect 0 chflags ${n0} none
expect 0 link ${n0} ${n1}
expect 0 unlink ${n1}
expect 0 chflags ${n0} SF_APPEND
expect EPERM link ${n0} ${n1}
expect 0 chflags ${n0} none
expect 0 link ${n0} ${n1}
expect 0 unlink ${n1}
expect 0 chflags ${n0} UF_APPEND
expect EPERM link ${n0} ${n1}
expect 0 chflags ${n0} none
expect 0 link ${n0} ${n1}
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 link ${n0} ${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n1}
case "${os}:${fs}" in
FreeBSD:ZFS)
expect 0 chflags ${n0} SF_APPEND
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
;;
FreeBSD:UFS)
expect 0 chflags ${n0} SF_APPEND
expect EPERM link ${n0} ${n1}
expect 0 chflags ${n0} none
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM link ${n0} ${n1}
expect 0 chflags ${n0} none
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} UF_APPEND
expect EPERM link ${n0} ${n1}
expect 0 chflags ${n0} none
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
;;
esac
expect 0 unlink ${n0}

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..32"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..29"
;;
FreeBSD:UFS)
echo "1..49"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -17,40 +26,61 @@ n2=`namegen`
expect 0 mkdir ${n0} 0755
expect 0 create ${n0}/${n1} 0644
expect 1 stat ${n0}/${n1} nlink
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 2 stat ${n0}/${n1} nlink
expect 0 unlink ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} SF_IMMUTABLE
expect EPERM link ${n0}/${n1} ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} none
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 2 stat ${n0}/${n1} nlink
expect 0 unlink ${n0}/${n2}
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM link ${n0}/${n1} ${n0}/${n2}
expect 0 chflags ${n0} none
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 0 unlink ${n0}/${n2}
expect 0 chflags ${n0} SF_APPEND
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n2}
expect 0 chflags ${n0} UF_APPEND
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 2 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 chflags ${n0} SF_APPEND
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 2 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM link ${n0}/${n1} ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} none
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 2 stat ${n0}/${n1} nlink
expect 0 unlink ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 2 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} UF_APPEND
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 2 stat ${n0}/${n1} nlink
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n2}
expect 1 stat ${n0}/${n1} nlink
;;
esac
expect 0 unlink ${n0}/${n1}
expect 0 rmdir ${n0}

View File

@ -6,29 +6,24 @@ desc="link returns EXDEV if the source and the destination files are on differen
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}" in
FreeBSD)
echo "1..8"
[ "${os}" = "FreeBSD" ] || quick_exit
n0=`namegen`
n1=`namegen`
n2=`namegen`
echo "1..8"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect EXDEV link ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
expect 0 create ${n1} 0644
expect EXDEV link ${n1} ${n0}/${n2}
expect 0 unlink ${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect EXDEV link ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
expect 0 create ${n1} 0644
expect EXDEV link ${n1} ${n0}/${n2}
expect 0 unlink ${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,33 +6,28 @@ desc="link returns ENOSPC if the directory in which the entry for the new link i
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..4"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
n2=`namegen`
echo "1..4"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
i=0
while :; do
link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC link ${n0}/${n1} ${n0}/${n2}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
i=0
while :; do
link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC link ${n0}/${n1} ${n0}/${n2}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,34 +6,29 @@ desc="link returns EROFS if the requested link requires writing in a directory o
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}" in
FreeBSD)
echo "1..9"
[ "${os}" = "FreeBSD" ] || quick_exit
n0=`namegen`
n1=`namegen`
n2=`namegen`
echo "1..9"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 0 unlink ${n0}/${n2}
mount -ur /dev/md${n}
expect EROFS link ${n0}/${n1} ${n0}/${n2}
mount -uw /dev/md${n}
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 0 unlink ${n0}/${n2}
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 0 unlink ${n0}/${n2}
mount -ur /dev/md${n}
expect EROFS link ${n0}/${n1} ${n0}/${n2}
mount -uw /dev/md${n}
expect 0 link ${n0}/${n1} ${n0}/${n2}
expect 0 unlink ${n0}/${n2}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..30"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..17"
;;
FreeBSD:UFS)
echo "1..30"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -24,30 +33,34 @@ expect 0 chflags ${n0} none
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} none
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} SF_APPEND
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} UF_APPEND
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} none
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} UF_APPEND
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
;;
esac
expect 0 rmdir ${n0}

View File

@ -6,29 +6,24 @@ desc="mkdir returns EROFS if the named file resides on a read-only file system"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..7"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..7"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS mkdir ${n0}/${n1} 0755
mount -uw /dev/md${n}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS mkdir ${n0}/${n1} 0755
mount -uw /dev/md${n}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,31 +6,26 @@ desc="mkdir returns ENOSPC if there are no free inodes on the file system on whi
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..3"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..3"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
mkdir ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC mkdir ${n0}/${n1} 0755
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
mkdir ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC mkdir ${n0}/${n1} 0755
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,29 +6,24 @@ desc="mkfifo returns EROFS if the named file resides on a read-only file system"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..7"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..7"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS mkfifo ${n0}/${n1} 0644
mount -uw /dev/md${n}
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS mkfifo ${n0}/${n1} 0644
mount -uw /dev/md${n}
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..30"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..17"
;;
FreeBSD:UFS)
echo "1..30"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -24,30 +33,34 @@ expect 0 chflags ${n0} none
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} SF_APPEND
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_APPEND
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} UF_APPEND
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
;;
esac
expect 0 rmdir ${n0}

View File

@ -6,31 +6,26 @@ desc="mkfifo returns ENOSPC if there are no free inodes on the file system on wh
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..3"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..3"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
mkfifo ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC mkfifo ${n0}/${n1} 0644
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
mkfifo ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC mkfifo ${n0}/${n1} 0644
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..30"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..17"
;;
FreeBSD:UFS)
echo "1..30"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -24,10 +33,9 @@ expect 0 chflags ${n0} none
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 chflags ${n0} none
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_APPEND
@ -35,19 +43,24 @@ expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_APPEND
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 chflags ${n0} none
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_APPEND
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
;;
esac
expect 0 rmdir ${n0}

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..28"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..14"
;;
FreeBSD:UFS)
echo "1..28"
;;
*)
quick_exit
esac
n0=`namegen`
@ -20,14 +29,6 @@ expect EPERM open ${n0} O_RDONLY,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM open ${n0} O_WRONLY
expect EPERM open ${n0} O_RDWR
expect EPERM open ${n0} O_RDONLY,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 open ${n0} O_WRONLY
@ -36,10 +37,22 @@ expect 0 open ${n0} O_RDONLY,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 open ${n0} O_WRONLY
expect 0 open ${n0} O_RDWR
expect 0 open ${n0} O_RDONLY,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM open ${n0} O_WRONLY
expect EPERM open ${n0} O_RDWR
expect EPERM open ${n0} O_RDONLY,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 open ${n0} O_WRONLY
expect 0 open ${n0} O_RDWR
expect 0 open ${n0} O_RDONLY,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
;;
esac

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..24"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..12"
;;
FreeBSD:UFS)
echo "1..24"
;;
*)
quick_exit
esac
n0=`namegen`
@ -18,22 +27,30 @@ expect 0 open ${n0} O_WRONLY,O_APPEND
expect 0 open ${n0} O_RDWR,O_APPEND
expect EPERM open ${n0} O_WRONLY
expect EPERM open ${n0} O_RDWR
todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
expect EPERM open ${n0} O_RDONLY,O_TRUNC
todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect 0 open ${n0} O_WRONLY,O_APPEND
expect 0 open ${n0} O_RDWR,O_APPEND
expect EPERM open ${n0} O_WRONLY
expect EPERM open ${n0} O_RDWR
expect EPERM open ${n0} O_RDONLY,O_TRUNC
expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect 0 open ${n0} O_WRONLY,O_APPEND
expect 0 open ${n0} O_RDWR,O_APPEND
expect EPERM open ${n0} O_WRONLY
expect EPERM open ${n0} O_RDWR
expect EPERM open ${n0} O_RDONLY,O_TRUNC
expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
;;
esac

View File

@ -6,32 +6,27 @@ desc="open returns EROFS if the named file resides on a read-only file system, a
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..10"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..10"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 open ${n0}/${n1} O_WRONLY
expect 0 open ${n0}/${n1} O_RDWR
expect 0 open ${n0}/${n1} O_RDONLY,O_TRUNC
mount -ur /dev/md${n}
expect EROFS open ${n0}/${n1} O_WRONLY
expect EROFS open ${n0}/${n1} O_RDWR
expect EROFS open ${n0}/${n1} O_RDONLY,O_TRUNC
mount -uw /dev/md${n}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 open ${n0}/${n1} O_WRONLY
expect 0 open ${n0}/${n1} O_RDWR
expect 0 open ${n0}/${n1} O_RDONLY,O_TRUNC
mount -ur /dev/md${n}
expect EROFS open ${n0}/${n1} O_WRONLY
expect EROFS open ${n0}/${n1} O_RDWR
expect EROFS open ${n0}/${n1} O_RDONLY,O_TRUNC
mount -uw /dev/md${n}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,27 +6,22 @@ desc="open returns EROFS when O_CREAT is specified and the named file would resi
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..5"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..5"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS open ${n0}/${n1} O_RDONLY,O_CREAT 0644
mount -uw /dev/md${n}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS open ${n0}/${n1} O_RDONLY,O_CREAT 0644
mount -uw /dev/md${n}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,20 +6,15 @@ desc="open returns EWOULDBLOCK when O_NONBLOCK and one of O_SHLOCK or O_EXLOCK i
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}" in
FreeBSD)
echo "1..6"
[ "${os}" = "FreeBSD" ] || quick_exit
n0=`namegen`
echo "1..6"
expect 0 create ${n0} 0644
expect 0 open ${n0} O_RDONLY,O_SHLOCK : open ${n0} O_RDONLY,O_SHLOCK,O_NONBLOCK
expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_EXLOCK : open ${n0} O_RDONLY,O_EXLOCK,O_NONBLOCK
expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_SHLOCK : open ${n0} O_RDONLY,O_EXLOCK,O_NONBLOCK
expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_EXLOCK : open ${n0} O_RDONLY,O_SHLOCK,O_NONBLOCK
expect 0 unlink ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
expect 0 create ${n0} 0644
expect 0 open ${n0} O_RDONLY,O_SHLOCK : open ${n0} O_RDONLY,O_SHLOCK,O_NONBLOCK
expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_EXLOCK : open ${n0} O_RDONLY,O_EXLOCK,O_NONBLOCK
expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_SHLOCK : open ${n0} O_RDONLY,O_EXLOCK,O_NONBLOCK
expect "EWOULDBLOCK|EAGAIN" open ${n0} O_RDONLY,O_EXLOCK : open ${n0} O_RDONLY,O_SHLOCK,O_NONBLOCK
expect 0 unlink ${n0}

View File

@ -3,35 +3,29 @@
desc="open returns ENOSPC when O_CREAT is specified, the file does not exist, and there are no free inodes on the file system on which the file is being created"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..3"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..3"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
touch ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC open ${n0}/${i} O_RDONLY,O_CREAT 0644
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
touch ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC open ${n0}/${i} O_RDONLY,O_CREAT 0644
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,20 +6,15 @@ desc="open returns ETXTBSY when the file is a pure procedure (shared text) file
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}" in
FreeBSD)
echo "1..4"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
echo "1..4"
cp -pf `which sleep` ${n0}
./${n0} 3 &
expect ETXTBSY open ${n0} O_WRONLY
expect ETXTBSY open ${n0} O_RDWR
expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC
expect 0 unlink ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
cp -pf `which sleep` ${n0}
./${n0} 3 &
expect ETXTBSY open ${n0} O_WRONLY
expect ETXTBSY open ${n0} O_RDWR
expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC
expect 0 unlink ${n0}

View File

@ -8,43 +8,90 @@ dir=`dirname $0`
require chflags
echo "1..84"
case "${os}:${fs}" in
FreeBSD:ZFS)
flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND"
echo "1..90"
;;
FreeBSD:UFS)
flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND UF_IMMUTABLE UF_NOUNLINK UF_APPEND"
echo "1..162"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
expect 0 create ${n0} 0644
for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0} ${n1}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n1} ${n0}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 mkdir ${n0} 0755
for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a directory protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0} ${n1}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a directory protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n1} ${n0}
done
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
expect 0 mkfifo ${n0} 0644
for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a fifo protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0} ${n1}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a fifo protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n1} ${n0}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 mknod ${n0} c 0644 1 2
for flag in ${flags}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0} ${n1}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n1} ${n0}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 bind ${n0}
for flag in ${flags}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a socket protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0} ${n1}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a socket protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n1} ${n0}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 symlink ${n1} ${n0}
for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags}; do
expect 0 lchflags ${n0} ${flag}
expect ${flag} lstat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a symlink protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0} ${n1}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a symlink protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n1} ${n0}
done
expect 0 lchflags ${n0} none
expect 0 unlink ${n0}

View File

@ -8,7 +8,20 @@ dir=`dirname $0`
require chflags
echo "1..106"
case "${os}:${fs}" in
FreeBSD:ZFS)
flags1="SF_IMMUTABLE SF_APPEND"
flags2="SF_NOUNLINK"
echo "1..110"
;;
FreeBSD:UFS)
flags1="SF_IMMUTABLE SF_APPEND UF_IMMUTABLE UF_APPEND"
flags2="SF_NOUNLINK UF_NOUNLINK"
echo "1..182"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -17,43 +30,79 @@ n2=`namegen`
expect 0 mkdir ${n0} 0755
expect 0 create ${n0}/${n1} 0644
for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND; do
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0}/${n1} ${n2}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n2} ${n0}/${n1}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 mkdir ${n0}/${n1} 0755
for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND; do
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0}/${n1} ${n2}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n2} ${n0}/${n1}
done
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
expect 0 mkfifo ${n0}/${n1} 0644
for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND; do
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0}/${n1} ${n2}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n2} ${n0}/${n1}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 mknod ${n0}/${n1} c 0644 1 2
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0}/${n1} ${n2}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n2} ${n0}/${n1}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 bind ${n0}/${n1}
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0}/${n1} ${n2}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n2} ${n0}/${n1}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 symlink ${n2} ${n0}/${n1}
for flag in SF_IMMUTABLE UF_IMMUTABLE SF_APPEND UF_APPEND; do
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect EPERM rename ${n0}/${n1} ${n2}
[ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM."
expect ENOENT rename ${n2} ${n0}/${n1}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 create ${n0}/${n1} 0644
for flag in SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n0}/${n1} ${n2}
@ -63,7 +112,7 @@ expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 mkdir ${n0}/${n1} 0755
for flag in SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n0}/${n1} ${n2}
@ -73,7 +122,27 @@ expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
expect 0 mkfifo ${n0}/${n1} 0644
for flag in SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n0}/${n1} ${n2}
expect 0 rename ${n2} ${n0}/${n1}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 mknod ${n0}/${n1} c 0644 1 2
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n0}/${n1} ${n2}
expect 0 rename ${n2} ${n0}/${n1}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 bind ${n0}/${n1}
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n0}/${n1} ${n2}
@ -83,7 +152,7 @@ expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 symlink ${n2} ${n0}/${n1}
for flag in SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n0}/${n1} ${n2}

View File

@ -8,7 +8,20 @@ dir=`dirname $0`
require chflags
echo "1..126"
case "${os}:${fs}" in
FreeBSD:ZFS)
flags1="SF_IMMUTABLE"
flags2="SF_NOUNLINK SF_APPEND"
echo "1..110"
;;
FreeBSD:UFS)
flags1="SF_IMMUTABLE UF_IMMUTABLE"
flags2="SF_NOUNLINK SF_APPEND UF_NOUNLINK UF_APPEND"
echo "1..188"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -17,7 +30,7 @@ n2=`namegen`
expect 0 mkdir ${n0} 0755
expect 0 create ${n1} 0644
for flag in SF_IMMUTABLE UF_IMMUTABLE; do
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect EPERM rename ${n1} ${n0}/${n2}
@ -26,7 +39,7 @@ expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 0 mkdir ${n1} 0755
for flag in SF_IMMUTABLE UF_IMMUTABLE; do
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect EPERM rename ${n1} ${n0}/${n2}
@ -35,7 +48,25 @@ expect 0 chflags ${n0} none
expect 0 rmdir ${n1}
expect 0 mkfifo ${n1} 0644
for flag in SF_IMMUTABLE UF_IMMUTABLE; do
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect EPERM rename ${n1} ${n0}/${n2}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 0 mknod ${n1} c 0644 1 2
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect EPERM rename ${n1} ${n0}/${n2}
done
expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 0 bind ${n1}
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect EPERM rename ${n1} ${n0}/${n2}
@ -44,7 +75,7 @@ expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 0 symlink ${n2} ${n1}
for flag in SF_IMMUTABLE UF_IMMUTABLE; do
for flag in ${flags1}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect EPERM rename ${n1} ${n0}/${n2}
@ -53,7 +84,7 @@ expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 0 create ${n1} 0644
for flag in SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n1} ${n0}/${n2}
@ -63,7 +94,7 @@ done
expect 0 unlink ${n1}
expect 0 mkdir ${n1} 0755
for flag in SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n1} ${n0}/${n2}
@ -73,7 +104,27 @@ done
expect 0 rmdir ${n1}
expect 0 mkfifo ${n1} 0644
for flag in SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n1} ${n0}/${n2}
expect 0 chflags ${n0} none
expect 0 rename ${n0}/${n2} ${n1}
done
expect 0 unlink ${n1}
expect 0 mknod ${n1} c 0644 1 2
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n1} ${n0}/${n2}
expect 0 chflags ${n0} none
expect 0 rename ${n0}/${n2} ${n1}
done
expect 0 unlink ${n1}
expect 0 bind ${n1}
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n1} ${n0}/${n2}
@ -83,7 +134,7 @@ done
expect 0 unlink ${n1}
expect 0 symlink ${n2} ${n1}
for flag in SF_APPEND UF_APPEND SF_NOUNLINK UF_NOUNLINK; do
for flag in ${flags2}; do
expect 0 chflags ${n0} ${flag}
expect ${flag} stat ${n0} flags
expect 0 rename ${n1} ${n0}/${n2}

View File

@ -6,40 +6,35 @@ desc="rename returns EXDEV if the link named by 'to' and the file named by 'from
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}" in
FreeBSD)
echo "1..14"
[ "${os}" = "FreeBSD" ] || quick_exit
n0=`namegen`
n1=`namegen`
n2=`namegen`
echo "1..14"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect 0 create ${n0}/${n1} 0644
expect EXDEV rename ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 mkdir ${n0}/${n1} 0755
expect EXDEV rename ${n0}/${n1} ${n2}
expect 0 rmdir ${n0}/${n1}
expect 0 create ${n0}/${n1} 0644
expect EXDEV rename ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
expect 0 mkfifo ${n0}/${n1} 0644
expect EXDEV rename ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
expect 0 mkdir ${n0}/${n1} 0755
expect EXDEV rename ${n0}/${n1} ${n2}
expect 0 rmdir ${n0}/${n1}
expect 0 symlink test ${n0}/${n1}
expect EXDEV rename ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
expect 0 mkfifo ${n0}/${n1} 0644
expect EXDEV rename ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
expect 0 symlink test ${n0}/${n1}
expect EXDEV rename ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,32 +6,27 @@ desc="rename returns EROFS if the requested link requires writing in a directory
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}" in
FreeBSD)
echo "1..8"
[ "${os}" = "FreeBSD" ] || quick_exit
n0=`namegen`
n1=`namegen`
n2=`namegen`
echo "1..8"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
mount -ur /dev/md${n}
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect EROFS rename ${n0}/${n1} ${n0}/${n2}
expect EROFS rename ${n0}/${n1} ${n2}
expect 0 create ${n2} 0644
expect EROFS rename ${n2} ${n0}/${n2}
expect 0 unlink ${n2}
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
mount -ur /dev/md${n}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
expect EROFS rename ${n0}/${n1} ${n0}/${n2}
expect EROFS rename ${n0}/${n1} ${n2}
expect 0 create ${n2} 0644
expect EROFS rename ${n2} ${n0}/${n2}
expect 0 unlink ${n2}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -1,14 +1,23 @@
#!/bin/sh
# $FreeBSD$
desc="rmdir returns EPERM if the named file has its immutable, undeletable or append-only flag set"
desc="rmdir returns EPERM if the named directory has its immutable, undeletable or append-only flag set"
dir=`dirname $0`
. ${dir}/../misc.sh
require chflags
echo "1..30"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..15"
;;
FreeBSD:UFS)
echo "1..30"
;;
*)
quick_exit
esac
n0=`namegen`
@ -18,32 +27,39 @@ expect EPERM rmdir ${n0}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
expect 0 mkdir ${n0} 0755
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM rmdir ${n0}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
expect 0 mkdir ${n0} 0755
expect 0 chflags ${n0} SF_NOUNLINK
expect EPERM rmdir ${n0}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
expect 0 mkdir ${n0} 0755
expect 0 chflags ${n0} UF_NOUNLINK
expect EPERM rmdir ${n0}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
expect 0 mkdir ${n0} 0755
expect 0 chflags ${n0} SF_APPEND
todo FreeBSD:ZFS "Removing a directory protected by SF_APPEND should return EPERM."
expect EPERM rmdir ${n0}
todo FreeBSD:ZFS "Removing a directory protected by SF_APPEND should return EPERM."
expect 0 chflags ${n0} none
todo FreeBSD:ZFS "Removing a directory protected by SF_APPEND should return EPERM."
expect 0 rmdir ${n0}
expect 0 mkdir ${n0} 0755
expect 0 chflags ${n0} UF_APPEND
expect EPERM rmdir ${n0}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 mkdir ${n0} 0755
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM rmdir ${n0}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
expect 0 mkdir ${n0} 0755
expect 0 chflags ${n0} UF_NOUNLINK
expect EPERM rmdir ${n0}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
expect 0 mkdir ${n0} 0755
expect 0 chflags ${n0} UF_APPEND
expect EPERM rmdir ${n0}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}
;;
esac

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..30"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..16"
;;
FreeBSD:UFS)
echo "1..30"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -21,32 +30,38 @@ expect EPERM rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} SF_APPEND
expect EPERM rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} UF_APPEND
expect EPERM rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} SF_APPEND
todo FreeBSD:ZFS "Removing an entry from directory protected by SF_APPEND should return EPERM."
expect EPERM rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
todo FreeBSD:ZFS "Removing an entry from directory protected by SF_APPEND should return EPERM."
expect 0 rmdir ${n0}/${n1}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 mkdir ${n0}/${n1} 0755
expect 0 chflags ${n0} UF_APPEND
expect EPERM rmdir ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 rmdir ${n0}/${n1}
;;
esac
expect 0 rmdir ${n0}

View File

@ -6,22 +6,17 @@ desc="rmdir returns EBUSY if the directory to be removed is the mount point for
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}" in
FreeBSD)
echo "1..3"
[ "${os}" = "FreeBSD" ] || quick_exit
n0=`namegen`
echo "1..3"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect EBUSY rmdir ${n0}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect EBUSY rmdir ${n0}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,27 +6,22 @@ desc="rmdir returns EROFS if the named file resides on a read-only file system"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..5"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..5"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 mkdir ${n0}/${n1} 0755
mount -ur /dev/md${n}
expect EROFS rmdir ${n0}/${n1}
mount -uw /dev/md${n}
expect 0 rmdir ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 mkdir ${n0}/${n1} 0755
mount -ur /dev/md${n}
expect EROFS rmdir ${n0}/${n1}
mount -uw /dev/md${n}
expect 0 rmdir ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..30"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..17"
;;
FreeBSD:UFS)
echo "1..30"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -24,10 +33,9 @@ expect 0 chflags ${n0} none
expect 0 symlink test ${n0}/${n1}
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_APPEND
@ -35,19 +43,24 @@ expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_APPEND
expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 symlink test ${n0}/${n1}
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} UF_APPEND
expect 0 symlink test ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
;;
esac
expect 0 rmdir ${n0}

View File

@ -6,32 +6,27 @@ desc="symlink returns EROFS if the file name2 would reside on a read-only file s
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..7"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
n2=`namegen`
echo "1..7"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect 0 symlink test ${n0}/${n1}
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS symlink test ${n0}/${n1}
mount -uw /dev/md${n}
expect 0 symlink test ${n0}/${n1}
expect 0 unlink ${n0}/${n1}
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
expect 0 symlink test ${n0}/${n1}
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS symlink test ${n0}/${n1}
mount -uw /dev/md${n}
expect 0 symlink test ${n0}/${n1}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,31 +6,26 @@ desc="symlink returns ENOSPC if there are no free inodes on the file system on w
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..3"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..3"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
ln -s test ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC symlink test ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 256k`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
i=0
while :; do
ln -s test ${n0}/${i} >/dev/null 2>&1
if [ $? -ne 0 ]; then
break
fi
i=`expr $i + 1`
done
expect ENOSPC symlink test ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..40"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..22"
;;
FreeBSD:UFS)
echo "1..44"
;;
*)
quick_exit
esac
n0=`namegen`
@ -18,30 +27,7 @@ expect EPERM truncate ${n0} 123
expect 0 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 truncate ${n0} 123
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM truncate ${n0} 123
expect 0 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 truncate ${n0} 123
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_APPEND
expect EPERM truncate ${n0} 123
expect 0 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 truncate ${n0} 123
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM truncate ${n0} 123
expect 0 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 truncate ${n0} 123
expect 123 stat ${n0} size
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
@ -52,8 +38,41 @@ expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 chflags ${n0} SF_APPEND
todo FreeBSD:ZFS "Truncating a file protected by SF_APPEND should return EPERM."
expect EPERM truncate ${n0} 123
todo FreeBSD:ZFS "Truncating a file protected by SF_APPEND should return EPERM."
expect 0 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 truncate ${n0} 123
expect 123 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM truncate ${n0} 123
expect 0 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 truncate ${n0} 123
expect 123 stat ${n0} size
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 truncate ${n0} 123
expect 123 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM truncate ${n0} 123
expect 0 stat ${n0} size
expect 0 chflags ${n0} none
expect 0 truncate ${n0} 123
expect 123 stat ${n0} size
expect 0 unlink ${n0}
;;
esac

View File

@ -6,32 +6,27 @@ desc="truncate returns EROFS if the named file resides on a read-only file syste
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..10"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..10"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 truncate ${n0}/${n1} 123
expect 123 stat ${n0}/${n1} size
mount -ur /dev/md${n}
expect EROFS truncate ${n0}/${n1} 1234
expect 123 stat ${n0}/${n1} size
mount -uw /dev/md${n}
expect 0 truncate ${n0}/${n1} 1234
expect 1234 stat ${n0}/${n1} size
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 truncate ${n0}/${n1} 123
expect 123 stat ${n0}/${n1} size
mount -ur /dev/md${n}
expect EROFS truncate ${n0}/${n1} 1234
expect 123 stat ${n0}/${n1} size
mount -uw /dev/md${n}
expect 0 truncate ${n0}/${n1} 1234
expect 1234 stat ${n0}/${n1} size
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}

View File

@ -6,18 +6,13 @@ desc="truncate returns ETXTBSY the file is a pure procedure (shared text) file t
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}" in
FreeBSD)
echo "1..2"
[ "${os}" = "FreeBSD" ] || quick_exit
n0=`namegen`
echo "1..2"
cp -pf `which sleep` ${n0}
./${n0} 3 &
expect ETXTBSY truncate ${n0} 123
expect 0 unlink ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
cp -pf `which sleep` ${n0}
./${n0} 3 &
expect ETXTBSY truncate ${n0} 123
expect 0 unlink ${n0}

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..30"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..15"
;;
FreeBSD:UFS)
echo "1..30"
;;
*)
quick_exit
esac
n0=`namegen`
@ -18,32 +27,39 @@ expect EPERM unlink ${n0}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM unlink ${n0}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_NOUNLINK
expect EPERM unlink ${n0}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect EPERM unlink ${n0}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} SF_APPEND
todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
expect EPERM unlink ${n0}
todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
expect 0 chflags ${n0} none
todo FreeBSD:ZFS "Removing a file protected by SF_APPEND should return EPERM."
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM unlink ${n0}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM unlink ${n0}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect EPERM unlink ${n0}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
expect 0 create ${n0} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM unlink ${n0}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}
;;
esac

View File

@ -8,7 +8,16 @@ dir=`dirname $0`
require chflags
echo "1..30"
case "${os}:${fs}" in
FreeBSD:ZFS)
echo "1..16"
;;
FreeBSD:UFS)
echo "1..30"
;;
*)
quick_exit
esac
n0=`namegen`
n1=`namegen`
@ -21,32 +30,38 @@ expect EPERM unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0} SF_APPEND
expect EPERM unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0} SF_NOUNLINK
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} SF_APPEND
todo FreeBSD:ZFS "Removing a file from a directory protected by SF_APPEND should return EPERM."
expect EPERM unlink ${n0}/${n1}
expect 0 chflags ${n0} none
todo FreeBSD:ZFS "Removing a file from a directory protected by SF_APPEND should return EPERM."
expect 0 unlink ${n0}/${n1}
case "${os}:${fs}" in
FreeBSD:UFS)
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0} UF_NOUNLINK
expect 0 unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0} UF_APPEND
expect EPERM unlink ${n0}/${n1}
expect 0 chflags ${n0} none
expect 0 unlink ${n0}/${n1}
;;
esac
expect 0 rmdir ${n0}

View File

@ -6,27 +6,22 @@ desc="unlink returns EROFS if the named file resides on a read-only file system"
dir=`dirname $0`
. ${dir}/../misc.sh
case "${os}:${fs}" in
FreeBSD:UFS)
echo "1..5"
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
n0=`namegen`
n1=`namegen`
echo "1..5"
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
mount -ur /dev/md${n}
expect EROFS unlink ${n0}/${n1}
mount -uw /dev/md${n}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}
;;
*)
quick_exit
;;
esac
n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
n=`mdconfig -a -n -t malloc -s 1m`
newfs /dev/md${n} >/dev/null
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
mount -ur /dev/md${n}
expect EROFS unlink ${n0}/${n1}
mount -uw /dev/md${n}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
mdconfig -d -u ${n}
expect 0 rmdir ${n0}