1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-26 10:39:01 +02:00

cp: with --no-preserve=mode ensure set-group-ID bits maintained on dirs

This issue was introduced in commit v8.19-145-g24ebca6

* src/copy.c (copy_internal): On systems that don't support ACLs,
the fallback default chmod done on directories should maintain
the set-group-ID, as that's generally auto-set by the system.
* NEWS: Mention the fix.
Reported by Bruno Haible on Alpine (with tests/cp/preserve-mode.sh)
This commit is contained in:
Pádraig Brady
2024-03-25 22:17:35 +00:00
parent c0f02a8f5b
commit 30039cb23a
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -12,6 +12,11 @@ GNU coreutils NEWS -*- outline -*-
to preserve ownership" when copying to GNU/Linux CIFS file systems.
They do this by working around some Linux CIFS bugs.
cp --no-preserve=mode will correctly maintain set-group-ID bits
for created directories. Previously on systems that didn't support ACLs,
cp would have reset the set-group-ID bit on created directories.
[bug introduced in coreutils-8.20]
join and uniq now support multi-byte characters better.
For example, 'join -tX' now works even if X is a multi-byte character,
and both programs now treat multi-byte characters like U+3000
+3
View File
@@ -3268,6 +3268,9 @@ skip:
{
int default_permissions = S_ISDIR (src_mode) || S_ISSOCK (src_mode)
? S_IRWXUGO : MODE_RW_UGO;
dst_mode = dst_sb.st_mode;
if (S_ISDIR (src_mode)) /* Keep set-group-ID for directories. */
default_permissions |= (dst_mode & S_ISGID);
if (set_acl (dst_name, -1, default_permissions & ~cached_umask ()) != 0)
return false;
}