ZFS datasets on Solaris (maybe others?) have this nifty little property
called "aclmode", which is set to "discard" by default[1]. That means that
when calling chmod() on a file, any non-trivial ACL gets removed. In
buf_write(), we almost always call mch_setperm(), causing that to happen.
If a user has backupcopy=no, then the ACL is restored, but if it's set to
yes, then vim skips the restoration.
I'm not sure how targeted the fix should be, but the attached patch seems
reasonable. We could keep track of whether mch_setperm() had been called
previously, but maybe that's overkill for something (not calling it) that's
very unlikely to happen.
[1] http://docs.oracle.com/cd/E23824_01/html/821-1462/zfs-1m.html
Thanks,
Danek
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/fileio.c b/src/fileio.c
index 1ceeaa7..f4fcc98 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4708,7 +4708,14 @@ restore_backup:
#ifdef HAVE_ACL
/* Probably need to set the ACL before changing the user (can't set the
* ACL on a file the user doesn't own). */
+ /* On Solaris, with ZFS and the aclmode property set to "discard" (the
+ * default, chmod() discards all part of a file's ACL that don't represent
+ * the mode of the file. It's non-trivial for us to discover whether we're
+ * in that situation, so we simply always re-set the ACL.
+ */
+#ifndef HAVE_SOLARIS_ZFS_ACL
if (!backup_copy)
+#endif
mch_set_acl(wfname, acl);
#endif
#ifdef FEAT_CRYPT