On Sun, May 3, 2009 at 6:33 PM, Bruno Haible <[email protected]> wrote:
>
> Can you please also provide an augmented unit test that exhibits the bug?
> (Additional code in tests/test-file-has-acl* ?)
>

I added a test case and made a few fixes for FreeBSD. I successfully
ran the acl tests on Linux and FreeBSD (I don't have access to a MacOS
X box).
From ec1d3584775aa3a1ea6e5d5300864edeea57b739 Mon Sep 17 00:00:00 2001
From: David Bartley <[email protected]>
Date: Sun, 3 May 2009 22:05:58 -0400
Subject: [PATCH] Fix test-file-has-acl on FreeBSD.

---
 ChangeLog                  |    6 ++++++
 tests/test-file-has-acl.c  |    5 ++++-
 tests/test-file-has-acl.sh |   15 ++++++++++-----
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fca76c1..e247913 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
 2009-05-04  David Bartley  <[email protected]>
+
+	Fix test-file-has-acl on FreeBSD.
+	* tests/test-file-has-acl.sh: Fix tests.
+	* tests/test-file-has-acl.c: Add alarm.
+
+2009-05-04  David Bartley  <[email protected]>
             Bruno Haible  <[email protected]>
 
 	acl: Fix infinite loop on FreeBSD.
diff --git a/tests/test-file-has-acl.c b/tests/test-file-has-acl.c
index daab4db..53b9c33 100644
--- a/tests/test-file-has-acl.c
+++ b/tests/test-file-has-acl.c
@@ -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
@@ -56,6 +56,9 @@ main (int argc, char *argv[])
 
 #if USE_ACL
   {
+    /* Check for inifite loops in file_has_acl.  */
+    alarm (5);
+
     int ret = file_has_acl (file, &statbuf);
     if (ret < 0)
       {
diff --git a/tests/test-file-has-acl.sh b/tests/test-file-has-acl.sh
index 9783960..de6f879 100755
--- a/tests/test-file-has-acl.sh
+++ b/tests/test-file-has-acl.sh
@@ -124,6 +124,10 @@ cd "$builddir" ||
     }
   }
 
+  # Check for infinite loop bug on FreeBSD.
+  mkdir tmpdir0
+  func_test_file_has_acl tmpdir0 no
+
   # func_test_has_acl file expected
   # tests the result of the file_has_acl function on file, and checks that it
   # matches the expected value, also taking into account the system's 'ls'
@@ -208,17 +212,18 @@ cd "$builddir" ||
             *)       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.
           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
 
           func_test_has_acl tmpfile0 no
-- 
1.5.6.5

Reply via email to