Eric Blake <[EMAIL PROTECTED]> wrote:
> According to Adam Price on 5/9/2005 11:39 PM:
>> Making check in touch
>> make  check-TESTS
>> PASS: relative
>> 0a1
>>> touch: setting times of `/': Permission denied
>> FAIL: not-owner
>
> I've noticed that cygwin also tends to fail this test, because the typical
> cygwin user installed / themselves (as c:\cygwin) and has write access to
> change /.  I don't know if there is a better approach to finding a
> directory that the user does not have rights to (cygwin will soon have //
> appear as a directory with read-only properties, so // might work, but
> doesn't generalize well).  Perhaps something like this is needed in
> tests/touch/not-owner:
>
> if test `stat -c %u /` = `id -u` ; then
...

Thanks to both of you.
I've just added tests to check owner/group and whether /
is writable -- using `test' makes it easier :)

Index: tests/touch/not-owner
===================================================================
RCS file: /fetish/cu/tests/touch/not-owner,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -p -r1.3 -r1.5
--- tests/touch/not-owner       23 Jun 2004 15:07:05 -0000      1.3
+++ tests/touch/not-owner       10 May 2005 13:30:39 -0000      1.5
@@ -11,6 +11,17 @@ fi
 . $srcdir/../lang-default
 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
 
+test=../../src/test
+if $test -w /; then
+  echo Skipping because you have write access to /.
+  (exit 77); exit 77
+fi
+
+if $test -O / || $test -G /; then
+  echo Skipping because you own /.
+  (exit 77); exit 77
+fi
+
 pwd=`pwd`
 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to