From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Romain Francoise Newsgroups: gmane.emacs.bugs 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 Organization: orebokech dot com Message-ID: <871uemm1sl.fsf@silenus.orebokech.com> References: <877goexm9e.fsf@gmx.de> <87licuytom.fsf@gmx.de> <83vcbyngxt.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1355935395 13551 80.91.229.3 (19 Dec 2012 16:43:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Dec 2012 16:43:15 +0000 (UTC) Cc: Michael Albinus , 13226@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 19 17:43:30 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TlMjq-0003Kn-Lw for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Dec 2012 17:43:22 +0100 Original-Received: from localhost ([::1]:56505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlMjc-0002pN-8J for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Dec 2012 11:43:08 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlMjU-0002mf-J9 for bug-gnu-emacs@gnu.org; Wed, 19 Dec 2012 11:43:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlMjT-00033A-24 for bug-gnu-emacs@gnu.org; Wed, 19 Dec 2012 11:43:00 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlMjS-000336-VD for bug-gnu-emacs@gnu.org; Wed, 19 Dec 2012 11:42:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TlMjV-0008Nw-Nq for bug-gnu-emacs@gnu.org; Wed, 19 Dec 2012 11:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Romain Francoise Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Dec 2012 16:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13226 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13226-submit@debbugs.gnu.org id=B13226.135593534532187 (code B ref 13226); Wed, 19 Dec 2012 16:43:01 +0000 Original-Received: (at 13226) by debbugs.gnu.org; 19 Dec 2012 16:42:25 +0000 Original-Received: from localhost ([127.0.0.1]:51047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TlMiv-0008N6-C0 for submit@debbugs.gnu.org; Wed, 19 Dec 2012 11:42:25 -0500 Original-Received: from stringer.orebokech.com ([88.190.240.207]:35807) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TlMis-0008Mx-SL for 13226@debbugs.gnu.org; Wed, 19 Dec 2012 11:42:23 -0500 Original-Received: from silenus.orebokech.com (silenus [192.168.1.4]) by stringer.orebokech.com (Postfix) with ESMTP id BB7791880327; Wed, 19 Dec 2012 17:42:18 +0100 (CET) Original-Received: by silenus.orebokech.com (Postfix, from userid 1000) id 96F50A0141; Wed, 19 Dec 2012 17:42:18 +0100 (CET) In-Reply-To: <83vcbyngxt.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 19 Dec 2012 18:29:50 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:68747 Archived-At: Eli Zaretskii 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) {