bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

perm test and ACLs


From: Kevin Mudrick
Subject: perm test and ACLs
Date: Wed, 22 Jun 2005 09:22:26 -0400

Similar to the cp-parents problem I reported yesterday, the mkdir/perm test 
also fails whe ACLs override umask.  Here's my approach to test if umask works 
before trying to test mkdir and umask.

--- coreutils-5.2.1/tests/mkdir/perm    2003-05-14 02:26:20.000000000 -0400
+++ coreutils-5.2.1-patched/tests/mkdir/perm    2005-06-21 15:35:44.071089541 
-0                                                                              
                                                 400
@@ -29,6 +29,30 @@
 
 . $abs_srcdir/../setgid-check
 
+# Check if umask will work
+# If umask and chmod give different permissions, exit
+# Try 000 (chmod 666) and 022 (chmod 644)
+for i in 000,666 022,644; do
+    umask=`echo $i | awk -F, '{ print \$1 }'`
+    chmod=`echo $i | awk -F, '{ print \$2 }'`
+    umask_tmpfile1=umask1-$$
+    umask_tmpfile2=umask2-$$
+    umask $umask 
+    > $umask_tmpfile1
+    > $umask_tmpfile2
+    chmod $chmod $umask_tmpfile2
+    perms1=`ls -ld $umask_tmpfile1 | sed 's/ .*//'`
+    perms2=`ls -ld $umask_tmpfile2 | sed 's/ .*//'`
+    rm -f $umask_tmpfile1 $umask_tmpfile2
+    if test $perms1 != $perms2; then
+       cat <<EOF >&2
+$0: Since it looks like you're running this test in a directory in
+which umask fails, we're skipping the remainder of this test.
+EOF
+       (exit 77); exit
+    fi
+done
+
 fail=0
 
 #                         parent        parent/dir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]