[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Bug fixes in acl module.
From: |
Bruno Haible |
Subject: |
Re: [PATCH] Bug fixes in acl module. |
Date: |
Mon, 4 May 2009 12:26:59 +0200 |
User-agent: |
KMail/1.9.9 |
David Bartley wrote:
> I added a test case and made a few fixes for FreeBSD.
Thanks, mostly applied, as below. I beefed up the use of 'alarm' to look like
in the other gnulib unit tests.
The part I did not apply is this one:
# Remove the ACL for the mask, if it was implicitly added.
case $acl_flavor in
- linux | freebsd) setfacl -x mask: tmpfile0 ;;
- *) setfacl -d mask: tmpfile0 ;;
+ linux) setfacl -x mask: tmpfile0 ;;
+ freebsd) setfacl -b -n tmpfile0 ;;
+ *) setfacl -d mask: tmpfile0 ;;
esac
It is pretty much clear that after removing all ACLs,
'func_test_has_acl tmpfile0 no' will work. The point of this test here is
whether it's possible to remove the 'mask' part of the ACL only. If
'setfacl -x mask: tmpfile0' leads to an error on FreeBSD, what is the
syntax that has to be used?
Is it setfacl -x mask:: tmpfile0 ?
Or maybe setfacl -x mask::1 tmpfile0 ?
> I successfully
> ran the acl tests on Linux and FreeBSD (I don't have access to a MacOS
> X box).
I tested on Linux and MacOS X (I don't have easy access to FreeBSD).
2009-05-04 David Bartley <address@hidden>
Bruno Haible <address@hidden>
Fix test-file-has-acl on FreeBSD.
* tests/test-file-has-acl.sh: Also test a directory. On FreeBSD, the
mask is implicitly added.
* tests/test-file-has-acl.c: Include <signal.h>.
(main): Terminate the test after 5 seconds.
* modules/acl-tests (configure.ac): Check for alarm function.
--- modules/acl-tests.orig 2009-05-04 12:18:32.000000000 +0200
+++ modules/acl-tests 2009-05-04 11:59:14.000000000 +0200
@@ -14,6 +14,7 @@
xalloc
configure.ac:
+AC_CHECK_DECLS_ONCE([alarm])
Makefile.am:
TESTS += test-file-has-acl.sh test-set-mode-acl.sh test-copy-acl.sh
--- tests/test-file-has-acl.c.orig 2009-05-04 12:18:32.000000000 +0200
+++ tests/test-file-has-acl.c 2009-05-04 11:58:21.000000000 +0200
@@ -1,5 +1,5 @@
/* Test for presence of ACL.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
#include "acl.h"
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -54,6 +55,14 @@
exit (EXIT_FAILURE);
}
+ /* Check against possible infinite loop in file_has_acl. */
+#if HAVE_DECL_ALARM
+ /* Declare failure if test takes too long, by using default abort
+ caused by SIGALRM. */
+ signal (SIGALRM, SIG_DFL);
+ alarm (5);
+#endif
+
#if USE_ACL
{
int ret = file_has_acl (file, &statbuf);
--- tests/test-file-has-acl.sh.orig 2009-05-04 12:18:32.000000000 +0200
+++ tests/test-file-has-acl.sh 2009-05-04 12:13:51.000000000 +0200
@@ -183,6 +183,9 @@
func_test_has_acl tmpfile0 no
+ mkdir tmpdir0
+ func_test_has_acl tmpdir0 no
+
if test $acl_flavor != none; then
# Use a user and group id different from the current one, to avoid
# redundant/ambiguous ACLs.
@@ -208,11 +211,11 @@
*) setfacl -d user:$auid:1 tmpfile0 ;;
esac
- # On Linux, the ACL for the mask is implicitly added.
+ # On Linux and FreeBSD, the ACL for the mask is implicitly added.
# On Solaris, it is always there.
case $acl_flavor in
- linux) func_test_has_acl tmpfile0 yes ;;
- *) func_test_has_acl tmpfile0 no ;;
+ linux | freebsd) func_test_has_acl tmpfile0 yes ;;
+ *) func_test_has_acl tmpfile0 no ;;
esac
# Remove the ACL for the mask, if it was implicitly added.
@@ -328,6 +331,7 @@
fi
rm -f tmpfile[0-9] tmp.err
+ rm -rf tmpdir0
) || exit 1
rm -rf "$tmp"