More tests, mostly related to devices and sockets.
This commit is contained in:
parent
8824c5ab76
commit
8afd703de9
@ -6,7 +6,7 @@ desc="mkdir returns EEXIST if the named file exists"
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..12"
|
||||
echo "1..21"
|
||||
|
||||
n0=`namegen`
|
||||
|
||||
@ -25,3 +25,15 @@ expect 0 unlink ${n0}
|
||||
expect 0 mkfifo ${n0} 0644
|
||||
expect EEXIST mkdir ${n0} 0755
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
expect EEXIST mkdir ${n0} 0755
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
expect EEXIST mkdir ${n0} 0755
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
expect EEXIST mkdir ${n0} 0755
|
||||
expect 0 unlink ${n0}
|
||||
|
@ -6,7 +6,7 @@ desc="open returns EEXIST when O_CREAT and O_EXCL were specified and the file ex
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..12"
|
||||
echo "1..21"
|
||||
|
||||
n0=`namegen`
|
||||
|
||||
@ -25,3 +25,15 @@ expect 0 unlink ${n0}
|
||||
expect 0 symlink test ${n0}
|
||||
expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
|
||||
expect 0 unlink ${n0}
|
||||
|
@ -6,7 +6,7 @@ desc="rename changes file name"
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..79"
|
||||
echo "1..145"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -57,6 +57,54 @@ expect fifo,${inode},0644,2 lstat ${n2} type,inode,mode,nlink
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n2}
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
expect block,0644,1 lstat ${n0} type,mode,nlink
|
||||
inode=`${fstest} lstat ${n0} inode`
|
||||
expect 0 rename ${n0} ${n1}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink
|
||||
expect block,${inode},0644,1 lstat ${n1} type,inode,mode,nlink
|
||||
expect 0 link ${n1} ${n0}
|
||||
expect block,${inode},0644,2 lstat ${n0} type,inode,mode,nlink
|
||||
expect block,${inode},0644,2 lstat ${n1} type,inode,mode,nlink
|
||||
expect 0 rename ${n1} ${n2}
|
||||
expect block,${inode},0644,2 lstat ${n0} type,inode,mode,nlink
|
||||
expect ENOENT lstat ${n1} type,mode,nlink
|
||||
expect block,${inode},0644,2 lstat ${n2} type,inode,mode,nlink
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n2}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
expect char,0644,1 lstat ${n0} type,mode,nlink
|
||||
inode=`${fstest} lstat ${n0} inode`
|
||||
expect 0 rename ${n0} ${n1}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink
|
||||
expect char,${inode},0644,1 lstat ${n1} type,inode,mode,nlink
|
||||
expect 0 link ${n1} ${n0}
|
||||
expect char,${inode},0644,2 lstat ${n0} type,inode,mode,nlink
|
||||
expect char,${inode},0644,2 lstat ${n1} type,inode,mode,nlink
|
||||
expect 0 rename ${n1} ${n2}
|
||||
expect char,${inode},0644,2 lstat ${n0} type,inode,mode,nlink
|
||||
expect ENOENT lstat ${n1} type,mode,nlink
|
||||
expect char,${inode},0644,2 lstat ${n2} type,inode,mode,nlink
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n2}
|
||||
|
||||
expect 0 -U 0133 bind ${n0}
|
||||
expect socket,0644,1 lstat ${n0} type,mode,nlink
|
||||
inode=`${fstest} lstat ${n0} inode`
|
||||
expect 0 rename ${n0} ${n1}
|
||||
expect ENOENT lstat ${n0} type,mode,nlink
|
||||
expect socket,${inode},0644,1 lstat ${n1} type,inode,mode,nlink
|
||||
expect 0 link ${n1} ${n0}
|
||||
expect socket,${inode},0644,2 lstat ${n0} type,inode,mode,nlink
|
||||
expect socket,${inode},0644,2 lstat ${n1} type,inode,mode,nlink
|
||||
expect 0 rename ${n1} ${n2}
|
||||
expect socket,${inode},0644,2 lstat ${n0} type,inode,mode,nlink
|
||||
expect ENOENT lstat ${n1} type,mode,nlink
|
||||
expect socket,${inode},0644,2 lstat ${n2} type,inode,mode,nlink
|
||||
expect 0 unlink ${n0}
|
||||
expect 0 unlink ${n2}
|
||||
|
||||
expect 0 create ${n0} 0644
|
||||
rinode=`${fstest} lstat ${n0} inode`
|
||||
expect regular,0644 lstat ${n0} type,mode
|
||||
@ -96,6 +144,30 @@ ctime2=`${fstest} stat ${n1} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 rename ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n1} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 rename ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n1} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 rename ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n1} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink ${n2} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
@ -129,6 +201,30 @@ ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 rename ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 rename ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 rename ${n0} ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 symlink ${n2} ${n0}
|
||||
ctime1=`${fstest} lstat ${n0} ctime`
|
||||
sleep 1
|
||||
|
@ -11,11 +11,11 @@ require chflags
|
||||
case "${os}:${fs}" in
|
||||
FreeBSD:ZFS)
|
||||
flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND"
|
||||
echo "1..90"
|
||||
echo "1..105"
|
||||
;;
|
||||
FreeBSD:UFS)
|
||||
flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND UF_IMMUTABLE UF_NOUNLINK UF_APPEND"
|
||||
echo "1..162"
|
||||
echo "1..189"
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
@ -60,6 +60,18 @@ done
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} b 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 mknod ${n0} c 0644 1 2
|
||||
for flag in ${flags}; do
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
|
@ -12,12 +12,12 @@ case "${os}:${fs}" in
|
||||
FreeBSD:ZFS)
|
||||
flags1="SF_IMMUTABLE SF_APPEND"
|
||||
flags2="SF_NOUNLINK"
|
||||
echo "1..110"
|
||||
echo "1..128"
|
||||
;;
|
||||
FreeBSD:UFS)
|
||||
flags1="SF_IMMUTABLE SF_APPEND UF_IMMUTABLE UF_APPEND"
|
||||
flags2="SF_NOUNLINK UF_NOUNLINK"
|
||||
echo "1..182"
|
||||
echo "1..212"
|
||||
;;
|
||||
*)
|
||||
quick_exit
|
||||
@ -65,6 +65,18 @@ done
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 mknod ${n0}/${n1} b 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 mknod ${n0}/${n1} c 0644 1 2
|
||||
for flag in ${flags1}; do
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
@ -131,6 +143,16 @@ done
|
||||
expect 0 chflags ${n0} none
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 mknod ${n0}/${n1} b 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 mknod ${n0}/${n1} c 0644 1 2
|
||||
for flag in ${flags2}; do
|
||||
expect 0 chflags ${n0} ${flag}
|
||||
|
@ -6,7 +6,7 @@ desc="rename returns EACCES or EPERM if the file pointed at by the 'to' argument
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..188"
|
||||
echo "1..1903"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -24,217 +24,305 @@ expect 0 chown ${n0} 65534 65534
|
||||
expect 0 mkdir ${n1} 0755
|
||||
expect 0 chmod ${n1} 01777
|
||||
|
||||
# User owns both: the sticky directory and the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the sticky directory, but doesn't own the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the destination file, but doesn't own the sticky directory.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User doesn't own the sticky directory nor the destination file.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65533 -g 65533 create ${n1}/${n3} 0644
|
||||
inode=`${fstest} lstat ${n1}/${n3} inode`
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
create_file() {
|
||||
case "${1}" in
|
||||
regular)
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
;;
|
||||
fifo)
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
;;
|
||||
block)
|
||||
expect 0 mknod ${n0}/${n2} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n2} 65534 65534
|
||||
;;
|
||||
char)
|
||||
expect 0 mknod ${n0}/${n2} c 0644 1 2
|
||||
expect 0 chown ${n0}/${n2} 65534 65534
|
||||
;;
|
||||
socket)
|
||||
expect 0 -u 65534 -g 65534 bind ${n0}/${n2}
|
||||
;;
|
||||
symlink)
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# User owns both: the sticky directory and the destination file.
|
||||
for type in regular fifo block char socket symlink; do
|
||||
# User owns both: the sticky directory and the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
create_file ${type}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} b 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} c 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 bind ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
|
||||
# User owns the sticky directory, but doesn't own the destination file.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
create_file ${type}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u ${id} -g ${id} create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u ${id} -g ${id} mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} b 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} ${id} ${id}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} c 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} ${id} ${id}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u ${id} -g ${id} bind ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u ${id} -g ${id} symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
|
||||
# User owns the destination file, but doesn't own the sticky directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} ${id} ${id}
|
||||
create_file ${type}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} b 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 mknod ${n1}/${n3} c 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 bind ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
|
||||
# User doesn't own the sticky directory nor the destination file.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} ${id} ${id}
|
||||
create_file ${type}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u ${id} -g ${id} create ${n1}/${n3} 0644
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 -u ${id} -g ${id} mkfifo ${n1}/${n3} 0644
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 mknod ${n1}/${n3} b 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} ${id} ${id}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 mknod ${n1}/${n3} c 0644 1 2
|
||||
expect 0 chown ${n1}/${n3} ${id} ${id}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 -u ${id} -g ${id} bind ${n1}/${n3}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 -u ${id} -g ${id} symlink test ${n1}/${n3}
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
done
|
||||
done
|
||||
|
||||
# User owns both: the sticky directory and the destination directory.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
# User owns the sticky directory, but doesn't own the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
# User owns the destination file, but doesn't own the sticky directory.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
# User doesn't own the sticky directory nor the destination file.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755
|
||||
expect 0 -u 65533 -g 65533 mkdir ${n1}/${n3} 0755
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect 0 rmdir ${n0}/${n2}
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
|
||||
# User owns both: the sticky directory and the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the sticky directory, but doesn't own the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the destination file, but doesn't own the sticky directory.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User doesn't own the sticky directory nor the destination file.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n2} 0644
|
||||
expect 0 -u 65533 -g 65533 mkfifo ${n1}/${n3} 0644
|
||||
inode=`${fstest} lstat ${n1}/${n3} inode`
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the sticky directory, but doesn't own the destination directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
# User owns both: the sticky directory and the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the sticky directory, but doesn't own the destination file.
|
||||
expect 0 chown ${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User owns the destination file, but doesn't own the sticky directory.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2}
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n1}/${n3}
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 create ${n0}/${n2} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n1}/${n3} ${n0}/${n2}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ENOENT lstat ${n1}/${n3} inode
|
||||
expect 0 -u 65534 -g 65534 mkfifo ${n1}/${n3} 0644
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} inode
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
# User doesn't own the sticky directory nor the destination file.
|
||||
expect 0 chown ${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n2}
|
||||
expect 0 -u 65533 -g 65533 symlink test ${n1}/${n3}
|
||||
inode=`${fstest} lstat ${n1}/${n3} inode`
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 unlink ${n0}/${n2}
|
||||
expect 0 unlink ${n1}/${n3}
|
||||
expect 0 -u ${id} -g ${id} mkdir ${n1}/${n3} 0755
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
done
|
||||
|
||||
# User owns the destination directory, but doesn't own the sticky directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} ${id} ${id}
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n1}/${n3} 0755
|
||||
expect 0 -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ENOENT lstat ${n0}/${n2} type
|
||||
expect ${inode} lstat ${n1}/${n3} inode
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
done
|
||||
|
||||
# User doesn't own the sticky directory nor the destination directory.
|
||||
for id in 0 65533; do
|
||||
expect 0 chown ${n1} ${id} ${id}
|
||||
expect 0 -u 65534 -g 65534 mkdir ${n0}/${n2} 0755
|
||||
inode=`${fstest} lstat ${n0}/${n2} inode`
|
||||
|
||||
expect 0 -u ${id} -g ${id} mkdir ${n1}/${n3} 0755
|
||||
expect "EACCES|EPERM" -u 65534 -g 65534 rename ${n0}/${n2} ${n1}/${n3}
|
||||
expect ${inode} lstat ${n0}/${n2} inode
|
||||
expect ${id},${id} lstat ${n1}/${n3} uid,gid
|
||||
expect 0 rmdir ${n0}/${n2}
|
||||
expect 0 rmdir ${n1}/${n3}
|
||||
done
|
||||
|
||||
expect 0 rmdir ${n1}
|
||||
expect 0 rmdir ${n0}
|
||||
|
@ -6,7 +6,7 @@ desc="rename returns ENOTDIR when the 'from' argument is a directory, but 'to' i
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..17"
|
||||
echo "1..32"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -25,6 +25,24 @@ expect dir lstat ${n0} type
|
||||
expect fifo lstat ${n1} type
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mknod ${n1} b 0644 1 2
|
||||
expect ENOTDIR rename ${n0} ${n1}
|
||||
expect dir lstat ${n0} type
|
||||
expect block lstat ${n1} type
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mknod ${n1} c 0644 1 2
|
||||
expect ENOTDIR rename ${n0} ${n1}
|
||||
expect dir lstat ${n0} type
|
||||
expect char lstat ${n1} type
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 bind ${n1}
|
||||
expect ENOTDIR rename ${n0} ${n1}
|
||||
expect dir lstat ${n0} type
|
||||
expect socket lstat ${n1} type
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink test ${n1}
|
||||
expect ENOTDIR rename ${n0} ${n1}
|
||||
expect dir lstat ${n0} type
|
||||
|
@ -6,7 +6,7 @@ desc="rename returns EISDIR when the 'to' argument is a directory, but 'from' is
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..17"
|
||||
echo "1..32"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -25,6 +25,24 @@ expect dir lstat ${n0} type
|
||||
expect fifo lstat ${n1} type
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mknod ${n1} b 0644 1 2
|
||||
expect EISDIR rename ${n1} ${n0}
|
||||
expect dir lstat ${n0} type
|
||||
expect block lstat ${n1} type
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 mknod ${n1} c 0644 1 2
|
||||
expect EISDIR rename ${n1} ${n0}
|
||||
expect dir lstat ${n0} type
|
||||
expect char lstat ${n1} type
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 bind ${n1}
|
||||
expect EISDIR rename ${n1} ${n0}
|
||||
expect dir lstat ${n0} type
|
||||
expect socket lstat ${n1} type
|
||||
expect 0 unlink ${n1}
|
||||
|
||||
expect 0 symlink test ${n1}
|
||||
expect EISDIR rename ${n1} ${n0}
|
||||
expect dir lstat ${n0} type
|
||||
|
@ -8,7 +8,7 @@ dir=`dirname $0`
|
||||
|
||||
[ "${os}" = "FreeBSD" ] || quick_exit
|
||||
|
||||
echo "1..14"
|
||||
echo "1..23"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -31,6 +31,18 @@ expect 0 mkfifo ${n0}/${n1} 0644
|
||||
expect EXDEV rename ${n0}/${n1} ${n2}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect EXDEV rename ${n0}/${n1} ${n2}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 mknod ${n0}/${n1} c 0644 1 2
|
||||
expect EXDEV rename ${n0}/${n1} ${n2}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 bind ${n0}/${n1}
|
||||
expect EXDEV rename ${n0}/${n1} ${n2}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
expect 0 symlink test ${n0}/${n1}
|
||||
expect EXDEV rename ${n0}/${n1} ${n2}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
@ -6,7 +6,7 @@ desc="rename returns EEXIST or ENOTEMPTY if the 'to' argument is a directory and
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..16"
|
||||
echo "1..25"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -27,6 +27,18 @@ expect 0 mkfifo ${n1}/${n2} 0644
|
||||
expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1}
|
||||
expect 0 unlink ${n1}/${n2}
|
||||
|
||||
expect 0 mknod ${n1}/${n2} b 0644 1 2
|
||||
expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1}
|
||||
expect 0 unlink ${n1}/${n2}
|
||||
|
||||
expect 0 mknod ${n1}/${n2} c 0644 1 2
|
||||
expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1}
|
||||
expect 0 unlink ${n1}/${n2}
|
||||
|
||||
expect 0 bind ${n1}/${n2}
|
||||
expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1}
|
||||
expect 0 unlink ${n1}/${n2}
|
||||
|
||||
expect 0 symlink test ${n1}/${n2}
|
||||
expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1}
|
||||
expect 0 unlink ${n1}/${n2}
|
||||
|
@ -6,7 +6,7 @@ desc="unlink removes regular files, symbolic links, fifos and sockets"
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..55"
|
||||
echo "1..112"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -31,7 +31,20 @@ expect fifo lstat ${n0} type
|
||||
expect 0 unlink ${n0}
|
||||
expect ENOENT lstat ${n0} type
|
||||
|
||||
# TODO: sockets removal
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
expect block lstat ${n0} type
|
||||
expect 0 unlink ${n0}
|
||||
expect ENOENT lstat ${n0} type
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
expect char lstat ${n0} type
|
||||
expect 0 unlink ${n0}
|
||||
expect ENOENT lstat ${n0} type
|
||||
|
||||
expect 0 bind ${n0}
|
||||
expect socket lstat ${n0} type
|
||||
expect 0 unlink ${n0}
|
||||
expect ENOENT lstat ${n0} type
|
||||
|
||||
# successful unlink(2) updates ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
@ -52,6 +65,33 @@ ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
expect 0 link ${n0} ${n1}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 unlink ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
expect 0 link ${n0} ${n1}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 unlink ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
expect 0 link ${n0} ${n1}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 unlink ${n1}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -lt $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
# unsuccessful unlink(2) does not update ctime.
|
||||
expect 0 create ${n0} 0644
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
@ -69,6 +109,30 @@ ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} b 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 unlink ${n0}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mknod ${n0} c 0644 1 2
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 unlink ${n0}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 bind ${n0}
|
||||
ctime1=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect EACCES -u 65534 unlink ${n0}
|
||||
ctime2=`${fstest} stat ${n0} ctime`
|
||||
test_check $ctime1 -eq $ctime2
|
||||
expect 0 unlink ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 create ${n0}/${n1} 0644
|
||||
time=`${fstest} stat ${n0} ctime`
|
||||
@ -91,6 +155,39 @@ ctime=`${fstest} stat ${n0} ctime`
|
||||
test_check $time -lt $ctime
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
time=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
mtime=`${fstest} stat ${n0} mtime`
|
||||
test_check $time -lt $mtime
|
||||
ctime=`${fstest} stat ${n0} ctime`
|
||||
test_check $time -lt $ctime
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 mknod ${n0}/${n1} c 0644 1 2
|
||||
time=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
mtime=`${fstest} stat ${n0} mtime`
|
||||
test_check $time -lt $mtime
|
||||
ctime=`${fstest} stat ${n0} ctime`
|
||||
test_check $time -lt $ctime
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 bind ${n0}/${n1}
|
||||
time=`${fstest} stat ${n0} ctime`
|
||||
sleep 1
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
mtime=`${fstest} stat ${n0} mtime`
|
||||
test_check $time -lt $mtime
|
||||
ctime=`${fstest} stat ${n0} ctime`
|
||||
test_check $time -lt $ctime
|
||||
expect 0 rmdir ${n0}
|
||||
|
||||
expect 0 mkdir ${n0} 0755
|
||||
expect 0 symlink test ${n0}/${n1}
|
||||
time=`${fstest} stat ${n0} ctime`
|
||||
|
@ -6,7 +6,7 @@ desc="unlink returns EACCES or EPERM if the directory containing the file is mar
|
||||
dir=`dirname $0`
|
||||
. ${dir}/../misc.sh
|
||||
|
||||
echo "1..33"
|
||||
echo "1..68"
|
||||
|
||||
n0=`namegen`
|
||||
n1=`namegen`
|
||||
@ -48,6 +48,56 @@ expect 0 -u 65534 -g 65534 mkfifo ${n0}/${n1} 0644
|
||||
expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
# User owns both: the sticky directory and the block device to be removed.
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
|
||||
# User owns the block device to be removed, but doesn't own the sticky directory.
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n1} 65533 65533
|
||||
expect 0 -u 65533 -g 65533 unlink ${n0}/${n1}
|
||||
# User owns the sticky directory, but doesn't own the block device to be removed.
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
|
||||
# User doesn't own the sticky directory nor the block directory to be removed.
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n1} 65534 65534
|
||||
expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
# User owns both: the sticky directory and the character device to be removed.
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n1} 65534 65534
|
||||
expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
|
||||
# User owns the character device to be removed, but doesn't own the sticky directory.
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n1} 65533 65533
|
||||
expect 0 -u 65533 -g 65533 unlink ${n0}/${n1}
|
||||
# User owns the sticky directory, but doesn't own the character device to be removed.
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n1} 65533 65533
|
||||
expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
|
||||
# User doesn't own the sticky directory nor the character directory to be removed.
|
||||
expect 0 mknod ${n0}/${n1} b 0644 1 2
|
||||
expect 0 chown ${n0}/${n1} 65534 65534
|
||||
expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
# User owns both: the sticky directory and the socket to be removed.
|
||||
expect 0 -u 65534 -g 65534 bind ${n0}/${n1}
|
||||
expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
|
||||
# User owns the socket to be removed, but doesn't own the sticky directory.
|
||||
expect 0 -u 65533 -g 65533 bind ${n0}/${n1}
|
||||
expect 0 -u 65533 -g 65533 unlink ${n0}/${n1}
|
||||
# User owns the sticky directory, but doesn't own the socket to be removed.
|
||||
expect 0 -u 65533 -g 65533 bind ${n0}/${n1}
|
||||
expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
|
||||
# User doesn't own the sticky directory nor the character directory to be removed.
|
||||
expect 0 -u 65534 -g 65534 bind ${n0}/${n1}
|
||||
expect "EACCES|EPERM" -u 65533 -g 65533 unlink ${n0}/${n1}
|
||||
expect 0 unlink ${n0}/${n1}
|
||||
|
||||
# User owns both: the sticky directory and the symlink to be removed.
|
||||
expect 0 -u 65534 -g 65534 symlink test ${n0}/${n1}
|
||||
expect 0 -u 65534 -g 65534 unlink ${n0}/${n1}
|
||||
|
Loading…
Reference in New Issue
Block a user