unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17810: 24.3.91; file-acl does not return ACL on Mac OS X
@ 2014-06-19 10:39 YAMAMOTO Mitsuharu
  2014-06-20  6:35 ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: YAMAMOTO Mitsuharu @ 2014-06-19 10:39 UTC (permalink / raw)
  To: 17810

On Mac OS X >= 10.5, the directory ~/Desktop has ACL, but (file-acl
"~/Desktop") returns nil.

  $ ls -lde ~/Desktop
  drwx------+ 4 mituharu  staff  136  6 11 12:04 /Users/mituharu/Desktop
   0: group:everyone deny delete

A comment in lib/qcopy-acl.c and lib/qset-acl.c says:

  # if !HAVE_ACL_TYPE_EXTENDED
    /* Linux, FreeBSD, IRIX, Tru64 */
...
  # else /* HAVE_ACL_TYPE_EXTENDED */
    /* Mac OS X */

    /* On Mac OS X,  acl_get_file (name, ACL_TYPE_ACCESS)
       and           acl_get_file (name, ACL_TYPE_DEFAULT)
       always return NULL / EINVAL.  You have to use
		     acl_get_file (name, ACL_TYPE_EXTENDED)
       or            acl_get_fd (open (name, ...))
       to retrieve an ACL.
       On the other hand,
		     acl_set_file (name, ACL_TYPE_ACCESS, acl)
       and           acl_set_file (name, ACL_TYPE_DEFAULT, acl)
       have the same effect as
		     acl_set_file (name, ACL_TYPE_EXTENDED, acl):
       Each of these calls sets the file's ACL.  */

So, the following lines in src/fileio.c seems to always result in
returning Qnil.

  acl = acl_get_file (SSDATA (absname), ACL_TYPE_ACCESS);
  if (acl == NULL)
    return Qnil;

If I change the above ACL_TYPE_ACCESS to ACL_TYPE_EXTENDED as an
experiment, then I get the following string as a result of (file-acl
"~/Desktop"):

  "!#acl 1
  group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C:everyone:12:deny:delete
  "

And I could pass it to set-file-acl to set ACL of another file.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#17810: 24.3.91; file-acl does not return ACL on Mac OS X
  2014-06-19 10:39 bug#17810: 24.3.91; file-acl does not return ACL on Mac OS X YAMAMOTO Mitsuharu
@ 2014-06-20  6:35 ` Paul Eggert
  2014-06-21  3:48   ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2014-06-20  6:35 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 17810

[-- Attachment #1: Type: text/plain, Size: 127 bytes --]

Thanks for the bug report.  Does the attached patch fix things for you? 
  I can't easily test it myself, as I don't use OS X.

[-- Attachment #2: acl.diff --]
[-- Type: text/plain, Size: 593 bytes --]

=== modified file 'src/fileio.c'
--- src/fileio.c	2014-06-08 00:59:05 +0000
+++ src/fileio.c	2014-06-20 06:30:09 +0000
@@ -3013,6 +3013,9 @@
   acl_t acl;
   Lisp_Object acl_string;
   char *str;
+# ifndef HAVE_ACL_TYPE_EXTENDED
+  acl_type_t ACL_TYPE_EXTENDED = ACL_TYPE_ACCESS;
+# endif
 #endif
 
   absname = expand_and_dir_to_file (filename,
@@ -3027,7 +3030,7 @@
 #ifdef HAVE_ACL_SET_FILE
   absname = ENCODE_FILE (absname);
 
-  acl = acl_get_file (SSDATA (absname), ACL_TYPE_ACCESS);
+  acl = acl_get_file (SSDATA (absname), ACL_TYPE_EXTENDED);
   if (acl == NULL)
     return Qnil;
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#17810: 24.3.91; file-acl does not return ACL on Mac OS X
  2014-06-20  6:35 ` Paul Eggert
@ 2014-06-21  3:48   ` YAMAMOTO Mitsuharu
  2014-06-21  7:04     ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: YAMAMOTO Mitsuharu @ 2014-06-21  3:48 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 17810

>>>>> On Thu, 19 Jun 2014 23:35:52 -0700, Paul Eggert <eggert@cs.ucla.edu> said:

> Thanks for the bug report.  Does the attached patch fix things for
> you?  I can't easily test it myself, as I don't use OS X.

Yes, it works for me.  Thanks.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#17810: 24.3.91; file-acl does not return ACL on Mac OS X
  2014-06-21  3:48   ` YAMAMOTO Mitsuharu
@ 2014-06-21  7:04     ` Paul Eggert
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2014-06-21  7:04 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 17810-done

OK, I installed that patch as emacs-24 bzr 117271 and am marking this as 
done.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-21  7:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-19 10:39 bug#17810: 24.3.91; file-acl does not return ACL on Mac OS X YAMAMOTO Mitsuharu
2014-06-20  6:35 ` Paul Eggert
2014-06-21  3:48   ` YAMAMOTO Mitsuharu
2014-06-21  7:04     ` Paul Eggert

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).