xref: /freebsd/contrib/pjdfstest/tests/chown/09.t (revision 41059135ce931c0f1014a999ffabc6bc470ce856)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/09.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="chown returns EROFS if the named file resides on a read-only file system"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..10"
12
13n0=`namegen`
14n1=`namegen`
15
16expect 0 mkdir ${n0} 0755
17n=`mdconfig -a -n -t malloc -s 1m` || exit
18newfs /dev/md${n} >/dev/null || exit
19mount /dev/md${n} ${n0} || exit
20expect 0 create ${n0}/${n1} 0644
21expect 0 chown ${n0}/${n1} 65534 65534
22expect 65534,65534 stat ${n0}/${n1} uid,gid
23mount -ur /dev/md${n}
24expect EROFS chown ${n0}/${n1} 65533 65533
25expect 65534,65534 stat ${n0}/${n1} uid,gid
26mount -uw /dev/md${n}
27expect 0 chown ${n0}/${n1} 65533 65533
28expect 65533,65533 stat ${n0}/${n1} uid,gid
29expect 0 unlink ${n0}/${n1}
30umount /dev/md${n}
31mdconfig -d -u ${n} || exit
32expect 0 rmdir ${n0}
33