Problem with --times and setgid dir when user not member of the group

G.raud graud at gmx.com
Thu Jan 4 06:53:15 UTC 2018


When copying locally as well as remotely inside a setgid dir, the option
--times has the unwanted side effect of making the newly created
directories not have the setgid bit set, but only when the user running
rsync is not a member of the corresponding group.  The extra option
--omit-dir-times prevents the loss of the setgid bit in this case.

Is this a bug as I think it is?  Note that files 2-levels deep in the
copied hierarchy do not have the group set to the one of the setgid
directory containing the hierarchy.

Here is a test log:

$ mkdir dir test
$ touch dir/file
$ chmod 0750 dir
$ chmod 2750 test
$ sudo chgrp games test
$ groups |grep games
$ rsync -r dir test
$ ls -l test
total 4
drwxr-s--- 2 guest games 4096 Jan  4 06:43 dir/
$ rm -rf test/dir
$ rsync -rt dir test
$ ls -l test
total 4
drwxr-x--- 2 guest games 4096 Jan  4 06:32 dir/
$ rm -rf test/dir
$ rsync -rtO dir test
$ ls -l test
total 4
drwxr-s--- 2 guest games 4096 Jan  4 06:43 dir/
$ rm -rf test/dir

The version is the latest (3.1.2 from Debian stretch):

$ 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



More information about the rsync mailing list