!(attr->ia_mode & S_ISGID))))
attr->ia_valid |= ATTR_FORCE;
- if ((mode & S_ISUID) &&
+ if ((attr->ia_valid & ATTR_MODE) &&
+ (mode & S_ISUID) &&
!(attr->ia_mode & S_ISUID) &&
!(attr->ia_valid & ATTR_KILL_SUID))
attr->ia_valid |= ATTR_KILL_SUID;
- if (((mode & (S_ISGID|S_IXGRP)) == (S_ISGID|S_IXGRP)) &&
+ if ((attr->ia_valid & ATTR_MODE) &&
+ ((mode & (S_ISGID|S_IXGRP)) == (S_ISGID|S_IXGRP)) &&
!(attr->ia_mode & S_ISGID) &&
!(attr->ia_valid & ATTR_KILL_SGID))
attr->ia_valid |= ATTR_KILL_SGID;
nobase_noinst_SCRIPTS += posix/posix.cfg
nobase_noinst_DATA = acl/cp.test acl/getfacl-noacl.test acl/inheritance.test
nobase_noinst_DATA += acl/misc.test acl/permissions.test acl/setfacl.test
-nobase_noinst_DATA += acl/974.test acl/974_remote.test acl/2561.test acl/2561_zfs.test
+nobase_noinst_DATA += acl/974.test acl/974_remote.test
+nobase_noinst_DATA += acl/2561.test acl/2561_zfs.test acl/4924.test
nobase_noinst_DATA += rmtacl/misc.test rmtacl/permissions.test
nobase_noinst_DATA += rmtacl/setfacl.test rmtacl/cp.test
nobase_noinst_DATA += rmtacl/getfacl-noacl.test rmtacl/inheritance.test
--- /dev/null
+LU-4924 - chmod g+s, touch should not clear sgid bit
+
+ $ mkdir 4924
+ $ cd 4924
+ $ touch f
+ $ chmod u=rwx,g=rwxs f
+ $ ls -l f | awk -- '{ print $1, $3, $4 }'
+ > -rwxrwsr-- root root
+ $ touch f
+ $ ls -l f | awk -- '{ print $1, $3, $4 }'
+ > -rwxrwsr-- root root
+ $ cd ..
+ $ rm -rf 4924
run_acl_subtest 2561_zfs || error "LU-2561 zfs test failed"
fi
+ run_acl_subtest 4924 || error "LU-4924 test failed"
+
cd $SAVE_PWD
umask $SAVE_UMASK