GNU bug report logs - #13226
24.3.50; set-file-acl on MS Windows shall check ACL string format

Previous Next

Package: emacs;

Reported by: Michael Albinus <michael.albinus <at> gmx.de>

Date: Wed, 19 Dec 2012 12:26:02 UTC

Severity: normal

Found in version 24.3.50

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 13226 <at> debbugs.gnu.org (full text, mbox):

From: Romain Francoise <romain <at> orebokech.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Michael Albinus <michael.albinus <at> gmx.de>, monnier <at> IRO.UMontreal.CA,
	13226 <at> debbugs.gnu.org
Subject: Re: bug#13226: 24.3.50;
	set-file-acl on MS Windows shall check ACL string format
Date: Wed, 19 Dec 2012 17:42:18 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> I think we are taking this feature out of proportions. It was supposed
> to allow copying extended attributes from file to file; for that, we
> don't need to care whether the ACL is trivial or not. But now we seem to
> start down the road of trying to interpret the ACL, which would need
> much more complex machinery. Do we really need that?

I agree with the sentiment, although it's not so much interpreting as just
avoiding having to carry the ACL if it doesn't convey any interesting
information... And at least on GNU/Linux it's not a lot of code:

diff --git a/configure.ac b/configure.ac
index 3c8be79..30740a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2206,6 +2206,10 @@ if test "${with_acl}" = "yes"; then
   if test "$HAVE_POSIX_ACL" = yes; then
     AC_DEFINE(HAVE_POSIX_ACL, 1, [Define to 1 if using POSIX ACL support.])
     LIBACL_LIBS=-lacl
+    OLD_LIBS="$LIBS"
+    LIBS="$LIBACL_LIBS $LIBS"
+    AC_CHECK_FUNCS(acl_equiv_mode)
+    LIBS="$OLD_LIBS"
   else
     AC_CHECK_FUNC(acl_set_file, HAVE_POSIX_ACL=yes, HAVE_POSIX_ACL=no)
     if test "$HAVE_POSIX_ACL" = yes; then
diff --git a/src/fileio.c b/src/fileio.c
index 26150a7..872e2be 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2030,6 +2030,15 @@ entries (depending on how Emacs was built).  */)
       acl = acl_get_fd (ifd);
       if (acl == NULL && errno != ENOTSUP)
 	report_file_error ("Getting ACL", Fcons (file, Qnil));
+#ifdef HAVE_ACL_EQUIV_MODE
+      if (acl != NULL && acl_equiv_mode (acl, NULL) == 0)
+	{
+	  /* All permissions can be represented by traditional file
+	     permission bits, ignore ACL.  */
+	  acl_free (acl);
+	  acl = NULL;
+	}
+#endif
 #endif
     }
 
@@ -3042,6 +3051,16 @@ files if the file handler returns nil for the file's ACL entries.  */)
   if (acl == NULL)
     return Qnil;
 
+#ifdef HAVE_ACL_EQUIV_MODE
+  if (acl_equiv_mode (acl, NULL) == 0)
+    {
+      /* All permissions can be represented by traditional file
+	 permission bits, ignore ACL.  */
+      acl_free (acl);
+      return Qnil;
+    }
+#endif
+
   str = acl_to_text (acl, NULL);
   if (str == NULL)
     {




This bug report was last modified 12 years and 194 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.