https://bugzilla.samba.org/show_bug.cgi?id=13239
Bug ID: 13239
Summary: "rsync --times" does not keep dirs' setgid bits when
user not member of setgid group
Product: rsync
Version: 3.1.2
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: core
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
When copying into a setgid dir, an extra option --times has the unwanted side
effect of making the newly created directories not have the setgid bit set
(and of creating files inside a newly created directory that do not belong to
the setgid group as expected); this happens only if the rsync user is not a
member of the setgid group.
In a shell one can set file times with touch(1) without losing the setgid bit
so rsync should be able to do so too (and if it does not document that).
Small shell script demonstrating the bug:
```log
$ mkdir ~/testdir && cd ~/testdir
$ mkdir -p src/subdir dest
$ touch src/file src/subdir/file
$ chmod 2750 dest
$ sudo chgrp games dest
$ groups |grep games || echo "$USER is not a member of games"
guest is not a member of games
$ ls -lR src
src:
total 4
-rw-r----- 1 guest guest 0 Jan 20 14:09 file
drwxr-x--- 2 guest guest 4096 Jan 20 14:09 subdir
src/subdir:
total 0
-rw-r----- 1 guest guest 0 Jan 20 14:09 file
$ groups |grep games || echo "guest is not a member of games"
guest is not a member of games
## Without --tiles, setgid bit and group set as expected
$ rsync -r src/ dest
$ ls -lR dest
dest:
total 4
-rw-r----- 1 guest games 0 Jan 20 14:16 file
drwxr-s--- 2 guest games 4096 Jan 20 14:16 subdir
dest/subdir:
total 0
-rw-r----- 1 guest games 0 Jan 20 14:16 file
$ rm -rf dest/*
## With --times, missing setgid bit and group inside subdir
$ rsync -rt src/ dest
$ ls -lR dest
dest:
total 4
-rw-r----- 1 guest games 0 Jan 20 14:09 file
drwxr-x--- 2 guest games 4096 Jan 20 14:09 subdir
dest/subdir:
total 0
-rw-r----- 1 guest guest 0 Jan 20 14:09 file
$ rm -rf dest/*
## With --times and --omit-dir-times, setgid bit and group set as expected
$ rsync -rtO src/ dest
$ ls -lR dest
dest:
total 4
-rw-r----- 1 guest games 0 Jan 20 14:09 file
drwxr-s--- 2 guest games 4096 Jan 20 14:20 subdir
dest/subdir:
total 0
-rw-r----- 1 guest games 0 Jan 20 14:09 file
$ rm -rf dest/*
```
The version is 3.1.2 from Debian stretch:
```log
$ rsync --version
rsync version 3.1.2 protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes, prealloc
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
$ dpkg -l rsync
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture
Description
+++-=============================-===================-===================-===============================================================
ii rsync 3.1.2-1+deb9u1 amd64 fast,
versatile, remote (and local) file-copying tool
```
Regards,
--
Géraud Meyer
--
You are receiving this mail because:
You are the QA Contact for the bug.
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html