summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-03-31 12:49:38 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-03-31 12:49:38 +0000
commitaf143103363406fc812a68a58dc08a8d7c3dac21 (patch)
tree91e11cf8a9eb0397c8c9d4e0b5dd790a64c6b20d /regress/usr.bin
parenta16786290d02b02179cafa25854b41e3f2db20a2 (diff)
Add tests to check the permissions of the created out file.
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/sort/stests26
1 files changed, 25 insertions, 1 deletions
diff --git a/regress/usr.bin/sort/stests b/regress/usr.bin/sort/stests
index 161f6f06a01..6c349fcb59b 100644
--- a/regress/usr.bin/sort/stests
+++ b/regress/usr.bin/sort/stests
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $OpenBSD: stests,v 1.9 2015/03/31 12:11:52 millert Exp $
+# $OpenBSD: stests,v 1.10 2015/03/31 12:49:37 bluhm Exp $
# from: @(#)stests 8.1 (Berkeley) 6/6/93
#Latest version. My sort passes all tests because I wrote it.
@@ -974,3 +974,27 @@ BEGIN {
}'
xsort A -u
+#---------------------------------------------------------------
+TEST=42; echo $TEST # overwrite permissions
+
+omask=`umask`
+:> in
+:> out
+
+umask 000
+chmod 0643 out
+$SORTPROG -o out in
+ls -l out | grep -e -rw-r---wx -q || echo ${TEST}A failed
+chmod u-w out
+$SORTPROG -o out in 2>/dev/null && echo ${TEST}B failed
+chmod 0643 out
+$SORTPROG -o out in out
+ls -l out | grep -e -rw-r---wx -q || echo ${TEST}C failed
+umask 071
+$SORTPROG -o out out
+ls -l out | grep -e -rw-r---wx -q || echo ${TEST}D failed
+chmod u-w out
+$SORTPROG -o out out 2>/dev/null && echo ${TEST}F failed
+
+rm -f in out
+umask $omask