all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Romain Francoise <romain@orebokech.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Michael Albinus <michael.albinus@gmx.de>, 13226@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <871uemm1sl.fsf@silenus.orebokech.com> (raw)
In-Reply-To: <83vcbyngxt.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 19 Dec 2012 18:29:50 +0200")

Eli Zaretskii <eliz@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)
     {





  reply	other threads:[~2012-12-19 16:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19 12:24 bug#13226: 24.3.50; set-file-acl on MS Windows shall check ACL string format Michael Albinus
2012-12-19 14:32 ` Stefan Monnier
2012-12-19 14:38   ` Michael Albinus
2012-12-19 16:25     ` Eli Zaretskii
2012-12-19 16:33   ` Eli Zaretskii
2012-12-19 14:34 ` Stefan Monnier
2012-12-19 14:59   ` Michael Albinus
2012-12-19 15:46     ` Romain Francoise
2012-12-19 15:57       ` Michael Albinus
2012-12-19 16:29     ` Eli Zaretskii
2012-12-19 16:42       ` Romain Francoise [this message]
2012-12-19 16:56         ` Eli Zaretskii
2012-12-19 17:44           ` Michael Albinus
2012-12-19 18:36       ` Stefan Monnier
2012-12-19 21:18         ` Eli Zaretskii
2012-12-20  0:53           ` Stefan Monnier
2012-12-22 14:19             ` Eli Zaretskii
2013-01-04 13:20               ` Michael Albinus
2012-12-19 16:23 ` Eli Zaretskii
2012-12-19 16:55   ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871uemm1sl.fsf@silenus.orebokech.com \
    --to=romain@orebokech.com \
    --cc=13226@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.