IFp4: Regression tests for FreeBSD/ZFS chflags(2)/lchflags(2).
This commit is contained in:
parent
74303ba55c
commit
36aca13fdf
@ -8,7 +8,25 @@ dir=`dirname $0`
|
||||
|
||||
require chflags
|
||||
|
||||
echo "1..191"
|
||||
case "${os}:${fs}" in
|
||||
FreeBSD:UFS)
|
||||
allflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
|
||||
userflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE"
|
||||
systemflags="SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
|
||||
|
||||
echo "1..247"
|
||||
;;
|
||||
FreeBSD:ZFS)
|
||||
allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
|
||||
userflags="UF_NODUMP"
|
||||
systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
|
||||
|
||||
echo "1..167"
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
esac
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -20,36 +38,36 @@ cd ${n2}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags
|
||||
expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${allflags}
|
||||
expect ${allflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${userflags}
|
||||
expect ${userflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${systemflags}
|
||||
expect ${systemflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags
|
||||
expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${allflags}
|
||||
expect ${allflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${userflags}
|
||||
expect ${userflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${systemflags}
|
||||
expect ${systemflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect none stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n0} flags
|
||||
expect 0 chflags ${n0} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${allflags}
|
||||
expect ${allflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${userflags}
|
||||
expect ${userflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} ${systemflags}
|
||||
expect ${systemflags} stat ${n0} flags
|
||||
expect 0 chflags ${n0} none
|
||||
expect none stat ${n0} flags
|
||||
expect 0 unlink ${n0}
|
||||
@ -58,14 +76,14 @@ expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect none stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 chflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n1} flags
|
||||
expect 0 chflags ${n1} ${allflags}
|
||||
expect ${allflags} stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 chflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE stat ${n1} flags
|
||||
expect 0 chflags ${n1} ${userflags}
|
||||
expect ${userflags} stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 chflags ${n1} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK stat ${n1} flags
|
||||
expect 0 chflags ${n1} ${systemflags}
|
||||
expect ${systemflags} stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 chflags ${n1} none
|
||||
expect none stat ${n1} flags
|
||||
@ -77,14 +95,14 @@ expect 0 create ${n0} 0644
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect none stat ${n1} flags
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 lchflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE,SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK lstat ${n1} flags
|
||||
expect 0 lchflags ${n1} ${allflags}
|
||||
expect ${allflags} lstat ${n1} flags
|
||||
expect none stat ${n1} flags
|
||||
expect 0 lchflags ${n1} UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
|
||||
expect UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE lstat ${n1} flags
|
||||
expect 0 lchflags ${n1} ${userflags}
|
||||
expect ${userflags} lstat ${n1} flags
|
||||
expect none stat ${n1} flags
|
||||
expect 0 lchflags ${n1} SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
|
||||
expect SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK lstat ${n1} flags
|
||||
expect 0 lchflags ${n1} ${systemflags}
|
||||
expect ${systemflags} lstat ${n1} flags
|
||||
expect none stat ${n1} flags
|
||||
expect 0 lchflags ${n1} none
|
||||
expect none lstat ${n1} flags
|
||||
@ -94,7 +112,7 @@ expect 0 unlink ${n0}
|
||||
|
||||
# successful chflags(2) updates ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
@ -104,7 +122,7 @@ done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
@ -114,7 +132,7 @@ done
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
@ -124,7 +142,7 @@ done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
for flag in UF_NODUMP UF_IMMUTABLE UF_APPEND UF_NOUNLINK UF_OPAQUE SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK none; do
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 lchflags ${n0} ${flag}
|
||||
@ -135,7 +153,7 @@ expect 0 unlink ${n0}
|
||||
|
||||
# unsuccessful chflags(2) does not update ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
for flag in UF_IMMUTABLE SF_IMMUTABLE none; do
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
@ -145,7 +163,7 @@ done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
for flag in UF_IMMUTABLE SF_IMMUTABLE none; do
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
@ -155,7 +173,7 @@ done
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
for flag in UF_IMMUTABLE SF_IMMUTABLE none; do
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 chflags ${n0} ${flag}
|
||||
@ -165,7 +183,7 @@ done
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
for flag in UF_IMMUTABLE SF_IMMUTABLE none; do
|
||||
for flag in `echo ${allflags},none | tr ',' ' '`; do
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EPERM -u 65534 lchflags ${n0} ${flag}
|
||||
|
@ -15,6 +15,6 @@ n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
expect ENOTDIR chflags ${n0}/${n1}/test UF_IMMUTABLE
|
||||
expect ENOTDIR chflags ${n0}/${n1}/test SF_IMMUTABLE
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
|
@ -11,8 +11,8 @@ require chflags
|
||||
echo "1..6"
|
||||
|
||||
expect 0 create ${name255} 0644
|
||||
expect 0 chflags ${name255} UF_IMMUTABLE
|
||||
expect UF_IMMUTABLE stat ${name255} flags
|
||||
expect 0 chflags ${name255} SF_IMMUTABLE
|
||||
expect SF_IMMUTABLE stat ${name255} flags
|
||||
expect 0 chflags ${name255} none
|
||||
expect 0 unlink ${name255}
|
||||
expect ENAMETOOLONG chflags ${name256} UF_IMMUTABLE
|
||||
expect ENAMETOOLONG chflags ${name256} SF_IMMUTABLE
|
||||
|
@ -15,10 +15,10 @@ expect 0 mkdir ${name255}/${name255} 0755
|
||||
expect 0 mkdir ${name255}/${name255}/${name255} 0755
|
||||
expect 0 mkdir ${path1021} 0755
|
||||
expect 0 create ${path1023} 0644
|
||||
expect 0 chflags ${path1023} UF_IMMUTABLE
|
||||
expect 0 chflags ${path1023} SF_IMMUTABLE
|
||||
expect 0 chflags ${path1023} none
|
||||
expect 0 unlink ${path1023}
|
||||
expect ENAMETOOLONG chflags ${path1024} UF_IMMUTABLE
|
||||
expect ENAMETOOLONG chflags ${path1024} SF_IMMUTABLE
|
||||
expect 0 rmdir ${path1021}
|
||||
expect 0 rmdir ${name255}/${name255}/${name255}
|
||||
expect 0 rmdir ${name255}/${name255}
|
||||
|
@ -14,6 +14,6 @@ n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect ENOENT chflags ${n0}/${n1}/test UF_IMMUTABLE
|
||||
expect ENOENT chflags ${n0}/${n1} UF_IMMUTABLE
|
||||
expect ENOENT chflags ${n0}/${n1}/test SF_IMMUTABLE
|
||||
expect ENOENT chflags ${n0}/${n1} SF_IMMUTABLE
|
||||
expect 0 rmdir ${n0}
|
||||
|
@ -20,14 +20,14 @@ cd ${n0}
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE
|
||||
expect UF_IMMUTABLE -u 65534 -g 65534 stat ${n1}/${n2} flags
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP
|
||||
expect UF_NODUMP -u 65534 -g 65534 stat ${n1}/${n2} flags
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none
|
||||
expect 0 chmod ${n1} 0644
|
||||
expect EACCES -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE
|
||||
expect EACCES -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP
|
||||
expect 0 chmod ${n1} 0755
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_IMMUTABLE
|
||||
expect UF_IMMUTABLE -u 65534 -g 65534 stat ${n1}/${n2} flags
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} UF_NODUMP
|
||||
expect UF_NODUMP -u 65534 -g 65534 stat ${n1}/${n2} flags
|
||||
expect 0 -u 65534 -g 65534 chflags ${n1}/${n2} none
|
||||
expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
|
||||
expect 0 rmdir ${n1}
|
||||
|
@ -15,7 +15,7 @@ n1=`namegen`
|
||||
|
||||
expect 0 symlink ${n0} ${n1}
|
||||
expect 0 symlink ${n1} ${n0}
|
||||
expect ELOOP chflags ${n0}/test UF_IMMUTABLE
|
||||
expect ELOOP chflags ${n1}/test UF_IMMUTABLE
|
||||
expect ELOOP chflags ${n0}/test SF_IMMUTABLE
|
||||
expect ELOOP chflags ${n1}/test SF_IMMUTABLE
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n1}
|
||||
|
@ -19,34 +19,34 @@ cdir=`pwd`
|
||||
cd ${n0}
|
||||
|
||||
expect 0 create ${n1} 0644
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect none stat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect none stat ${n1} flags
|
||||
expect 0 rmdir ${n1}
|
||||
|
||||
expect 0 mkfifo ${n1} 0644
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect none stat ${n1} flags
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect none stat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${n1}
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP
|
||||
expect none lstat ${n1} flags
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
|
@ -22,9 +22,9 @@ expect 0 create ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
@ -34,9 +34,9 @@ expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
@ -46,9 +46,9 @@ expect 0 mkfifo ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
@ -58,9 +58,9 @@ expect 0 symlink ${n2} ${n1}
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 lchflags ${n1} ${flag}
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP
|
||||
expect ${flag} lstat ${n1} flags
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE
|
||||
expect EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP
|
||||
expect ${flag} lstat ${n1} flags
|
||||
done
|
||||
expect 0 lchflags ${n1} none
|
||||
|
@ -25,11 +25,11 @@ expect 0 create ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
@ -39,11 +39,11 @@ expect 0 mkdir ${n1} 0755
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
@ -53,11 +53,11 @@ expect 0 mkfifo ${n1} 0644
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 chflags ${n1} ${flag}
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 chflags ${n1} UF_NODUMP
|
||||
expect ${flag} stat ${n1} flags
|
||||
done
|
||||
expect 0 chflags ${n1} none
|
||||
@ -67,11 +67,11 @@ expect 0 symlink ${n2} ${n1}
|
||||
expect 0 lchown ${n1} 65534 65534
|
||||
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
|
||||
expect 0 lchflags ${n1} ${flag}
|
||||
jexpect 1 `pwd` EPERM lchflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM lchflags ${n1} UF_NODUMP
|
||||
expect ${flag} lstat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM -u 65533 -g 65533 lchflags ${n1} UF_NODUMP
|
||||
expect ${flag} lstat ${n1} flags
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_IMMUTABLE
|
||||
jexpect 1 `pwd` EPERM -u 65534 -g 65534 lchflags ${n1} UF_NODUMP
|
||||
expect ${flag} lstat ${n1} flags
|
||||
done
|
||||
expect 0 lchflags ${n1} none
|
||||
|
@ -6,7 +6,7 @@ desc="chflags returns EPERM if a user tries to set or remove the SF_SNAPSHOT fla
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
require chflags
|
||||
require chflags_SF_SNAPSHOT
|
||||
|
||||
echo "1..46"
|
||||
|
||||
|
@ -37,6 +37,31 @@ FreeBSD:UFS)
|
||||
mdconfig -d -u ${n}
|
||||
expect 0 rmdir ${n0}
|
||||
;;
|
||||
FreeBSD:ZFS)
|
||||
echo "1..12"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
|
||||
n=`mdconfig -a -n -t malloc -s 128m`
|
||||
zpool create ${n0} /dev/md${n}
|
||||
expect 0 create /${n0}/${n1} 0644
|
||||
expect 0 chflags /${n0}/${n1} UF_NODUMP
|
||||
expect UF_NODUMP stat /${n0}/${n1} flags
|
||||
expect 0 chflags /${n0}/${n1} none
|
||||
expect none stat /${n0}/${n1} flags
|
||||
zfs set readonly=on ${n0}
|
||||
expect EROFS chflags /${n0}/${n1} UF_NODUMP
|
||||
expect none stat /${n0}/${n1} flags
|
||||
zfs set readonly=off ${n0}
|
||||
expect 0 chflags /${n0}/${n1} UF_NODUMP
|
||||
expect UF_NODUMP stat /${n0}/${n1} flags
|
||||
expect 0 chflags /${n0}/${n1} none
|
||||
expect none stat /${n0}/${n1} flags
|
||||
expect 0 unlink /${n0}/${n1}
|
||||
zpool destroy ${n0}
|
||||
mdconfig -d -u ${n}
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
;;
|
||||
|
@ -10,5 +10,5 @@ require chflags
|
||||
|
||||
echo "1..2"
|
||||
|
||||
expect EFAULT chflags NULL UF_IMMUTABLE
|
||||
expect EFAULT chflags DEADCODE UF_IMMUTABLE
|
||||
expect EFAULT chflags NULL UF_NODUMP
|
||||
expect EFAULT chflags DEADCODE UF_NODUMP
|
||||
|
@ -73,13 +73,18 @@ quick_exit()
|
||||
supported()
|
||||
{
|
||||
case "${1}" in
|
||||
chflags)
|
||||
if [ ${os} != "FreeBSD" -o ${fs} != "UFS" ]; then
|
||||
lchmod)
|
||||
if [ "${os}" != "FreeBSD" ]; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
lchmod)
|
||||
if [ ${os} != "FreeBSD" ]; then
|
||||
chflags)
|
||||
if [ "${os}" != "FreeBSD" ]; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
chflags_SF_SNAPSHOT)
|
||||
if [ "${os}" != "FreeBSD" -o "${fs}" != "UFS" ]; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user