Do not archive NFSv4 ACLs on Mac OS X by default.
This avoids wrtiting ACLs to tar files twice. Preferred method is
via copyfile(3) (tar option --mac-metadata). If user wants to create
archives with portable NFSv4 ACLs only (SCHILY.acl.ace header with no
GUID data) the --acls and --no-mac-metadata options must be specified
on the command line.
In the manual page be more specific which types of ACLs are stored
with --acls and --mac-metadata options.
diff --git a/tar/bsdtar.1 b/tar/bsdtar.1
index c4486a3..b60f09c 100644
--- a/tar/bsdtar.1
+++ b/tar/bsdtar.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 23, 2017
+.Dd February 24, 2017
.Dt TAR 1
.Os
.Sh NAME
@@ -167,11 +167,14 @@
restricted pax format and bzip2 compression.
.It Fl Fl acls
(c, r, u, x modes only)
-Archive or extract ACLs. This is the reverse of
+Archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of
.Fl Fl no-acls
-and the default behavior in c, r, and u modes or if
+and the default behavior in c, r, and u modes (except Mac OS X) or if
.Nm
-is run in x mode as root.
+is run in x mode as root. On Mac OS X this option translates extended ACLs
+to NFSv4 ACLs. To store extended ACLs the
+.Fl Fl mac-metadata
+option is preferred.
.It Fl B , Fl Fl read-full-blocks
Ignored for compatibility with other
.Xr tar 1
@@ -359,7 +362,8 @@
By default, the modification time is set to the time stored in the archive.
.It Fl Fl mac-metadata
(c, r, u and x mode only)
-Mac OS X specific. Archive or extract ACLs and extended attributes using
+Mac OS X specific. Archive or extract extended ACLs and extended attributes
+using
.Xr copyfile 3
in AppleDouble format. This is the reverse of
.Fl Fl no-mac-metadata .
@@ -408,11 +412,11 @@
.Xr find 1 .
.It Fl Fl no-acls
(c, r, u, x modes only)
-Do not archive or extract ACLs. This is the reverse of
+Do not archive or extract POSIX.1e or NFSv4 ACLs. This is the reverse of
.Fl Fl acls
and the default behavior if
.Nm
-is run as non-root in x mode.
+is run as non-root in x mode (on Mac OS X also in c, r and u modes).
.It Fl Fl no-fflags
(c, r, u, x modes only)
Do not archive or extract file flags. This is the reverse of
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
index 591da19..a9252a5 100644
--- a/tar/bsdtar.c
+++ b/tar/bsdtar.c
@@ -232,6 +232,14 @@
if (getenv(COPYFILE_DISABLE_VAR))
bsdtar->readdisk_flags &= ~ARCHIVE_READDISK_MAC_COPYFILE;
#endif
+#if defined(__APPLE__)
+ /*
+ * On Mac OS ACLs are archived with copyfile() (--mac-metadata)
+ * Translation to NFSv4 ACLs has to be requested explicitly with --acls
+ */
+ bsdtar->readdisk_flags |= ARCHIVE_READDISK_NO_ACL;
+#endif
+
bsdtar->matching = archive_match_new();
if (bsdtar->matching == NULL)
lafe_errc(1, errno, "Out of memory");