aboutsummaryrefslogtreecommitdiff
path: root/tests/chown
diff options
context:
space:
mode:
Diffstat (limited to 'tests/chown')
-rw-r--r--tests/chown/00.t23
-rw-r--r--tests/chown/01.t1
-rw-r--r--tests/chown/02.t1
-rw-r--r--tests/chown/03.t1
-rw-r--r--tests/chown/04.t1
-rw-r--r--tests/chown/05.t1
-rw-r--r--tests/chown/06.t1
-rw-r--r--tests/chown/07.t1
-rw-r--r--tests/chown/08.t1
-rw-r--r--tests/chown/09.t9
-rw-r--r--tests/chown/10.t1
11 files changed, 37 insertions, 4 deletions
diff --git a/tests/chown/00.t b/tests/chown/00.t
index 5c6be97d66dd..d62fba7b0e8c 100644
--- a/tests/chown/00.t
+++ b/tests/chown/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/00.t 228975 2011-12-30 00:04:11Z uqs $
desc="chown changes ownership"
@@ -213,6 +214,20 @@ done
# when non-super-user calls chown(2) successfully, set-uid and set-gid bits may
# be removed, except when both uid and gid are equal to -1.
for type in regular dir fifo block char socket symlink; do
+ #
+ # Linux makes a destinction for behavior when an executable file vs a
+ # non-executable file. From chmod(2):
+ #
+ # When the owner or group of an executable file are changed by an
+ # unprivileged user the S_ISUID and S_ISGID mode bits are cleared.
+ #
+ # I believe in this particular case, the behavior's bugged.
+ #
+ if [ "${type}" = "dir" -a "${os}" = "Linux" ]; then
+ _todo_msg="Linux doesn't clear the SGID/SUID bits for directories, despite the description noted"
+ else
+ _todo_msg=
+ fi
if [ "${type}" != "symlink" ]; then
create_file ${type} ${n0}
@@ -220,10 +235,12 @@ for type in regular dir fifo block char socket symlink; do
expect 0 chmod ${n0} 06555
expect 06555,65534,65533 stat ${n0} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65532 stat ${n0} mode,uid,gid
expect 0 chmod ${n0} 06555
expect 06555,65534,65532 stat ${n0} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 65533
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65533 stat ${n0} mode,uid,gid
expect 0 chmod ${n0} 06555
expect 06555,65534,65533 stat ${n0} mode,uid,gid
@@ -236,13 +253,17 @@ for type in regular dir fifo block char socket symlink; do
expect 06555,65534,65533 stat ${n0} mode,uid,gid
expect 06555,65534,65533 stat ${n1} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 chown ${n1} 65534 65532
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65532 stat ${n0} mode,uid,gid
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65532 stat ${n1} mode,uid,gid
expect 0 chmod ${n1} 06555
expect 06555,65534,65532 stat ${n0} mode,uid,gid
expect 06555,65534,65532 stat ${n1} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 -- chown ${n1} -1 65533
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65533 stat ${n0} mode,uid,gid
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65533 stat ${n1} mode,uid,gid
expect 0 chmod ${n1} 06555
expect 06555,65534,65533 stat ${n0} mode,uid,gid
@@ -270,6 +291,7 @@ for type in regular dir fifo block char socket symlink; do
fi
expect 06555,65534,65533 lstat ${n0} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 lchown ${n0} 65534 65532
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65532 lstat ${n0} mode,uid,gid
if supported lchmod; then
expect 0 lchmod ${n0} 06555
@@ -278,6 +300,7 @@ for type in regular dir fifo block char socket symlink; do
fi
expect 06555,65534,65532 lstat ${n0} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 -- lchown ${n0} -1 65533
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65533 lstat ${n0} mode,uid,gid
if supported lchmod; then
expect 0 lchmod ${n0} 06555
diff --git a/tests/chown/01.t b/tests/chown/01.t
index 1813394aee83..a60126a4f466 100644
--- a/tests/chown/01.t
+++ b/tests/chown/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="chown returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/chown/02.t b/tests/chown/02.t
index e110db8261ba..e65d38eec24c 100644
--- a/tests/chown/02.t
+++ b/tests/chown/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="chown returns ENAMETOOLONG if a component of a pathname exceeded ${NAME_MAX} characters"
diff --git a/tests/chown/03.t b/tests/chown/03.t
index 031a878f3524..3cb1ded0081e 100644
--- a/tests/chown/03.t
+++ b/tests/chown/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="chown returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/chown/04.t b/tests/chown/04.t
index d6eac198ed1e..4b66bacb7422 100644
--- a/tests/chown/04.t
+++ b/tests/chown/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/04.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns ENOENT if the named file does not exist"
diff --git a/tests/chown/05.t b/tests/chown/05.t
index 5a27a9ca90fc..68b52b88b0ca 100644
--- a/tests/chown/05.t
+++ b/tests/chown/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/05.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/chown/06.t b/tests/chown/06.t
index a7ac349c02f8..aaec6177689e 100644
--- a/tests/chown/06.t
+++ b/tests/chown/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/06.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/chown/07.t b/tests/chown/07.t
index f188080d05ec..bf7c544eeee3 100644
--- a/tests/chown/07.t
+++ b/tests/chown/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/07.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user and the process is not an owner of the file"
diff --git a/tests/chown/08.t b/tests/chown/08.t
index a98f873ff91b..3e1db6411f8f 100644
--- a/tests/chown/08.t
+++ b/tests/chown/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="chown returns EPERM if the named file has its immutable or append-only flag set"
diff --git a/tests/chown/09.t b/tests/chown/09.t
index 455f43690706..9fd44df5fe01 100644
--- a/tests/chown/09.t
+++ b/tests/chown/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="chown returns EROFS if the named file resides on a read-only file system"
@@ -14,9 +15,9 @@ 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}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
expect 0 chown ${n0}/${n1} 65534 65534
expect 65534,65534 stat ${n0}/${n1} uid,gid
@@ -28,5 +29,5 @@ 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}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/chown/10.t b/tests/chown/10.t
index e791008ee54e..6e7f8207a1d4 100644
--- a/tests/chown/10.t
+++ b/tests/chown/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/10.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns EFAULT if the path argument points outside the process's allocated address space"