+ if (has_default_mask_acl(parent)) {
+ /* The parent has an extended ACL. Extended ACLs use the mask
+ entry. */
+
+ /* For the group bits, we'll use the ACL's mask instead of the group
+ object bits. If the default ACL had a group entry, it should
+ already have propagated (but might be masked). */
+ if (has_default_mask_read(parent)) {
+ path_mode |= S_IRGRP;
+ }
+ else {
+ path_mode &= ~S_IRGRP;
+ }
+
+ if (has_default_mask_write(parent)) {
+ path_mode |= S_IWGRP;
+ }
+ else {
+ path_mode &= ~S_IWGRP;
+ }
+
+ if (!mode_has_perm(path_mode, S_IXGRP)) {
+ /* The group ACL entry should already have been inherited from the
+ default ACL. If the source was not group executable, we want to
+ modify the destination so that it is not group executable
+ either. In the presence of ACLs, the group permissions come not
+ from the mode bits, but from the group:: ACL entry. So, to do
+ this, we remove the group::x entry. */
+ remove_default_group_obj_execute(path);
+ }
+
+ /* We need to determine whether or not to mask the execute
+ bit. This applies not only to the user/group/other entries, but
+ also to all other named entries. If the original file wasn't
+ executable, then the result probably should not be. To
+ determine whether or not "it was executable", we rely on the
+ user execute bits. Obviously this should be done before we
+ twiddle that bit. */
+ if (has_default_mask_execute(parent)) {
+ if (mode_has_perm(path_mode, S_IXUSR)) {
+ /* This just adds the group execute bit, and doesn't actually
+ grant group execute permissions. */
+ path_mode |= S_IXGRP;
+ }
+ }
+ else {
+ path_mode &= ~S_IXGRP;
+ }
+