Bug 13820 - rsync is not preserving ACLs
Summary: rsync is not preserving ACLs
Status: RESOLVED INVALID
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.3
Hardware: x64 Linux
: P5 major (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-05 07:44 UTC by Dinesh Reddy
Modified: 2019-03-16 18:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dinesh Reddy 2019-03-05 07:44:00 UTC
Hi,
rsync seems to be not preserving ACLs like it is mentioned in the man pages.
Here the case is that source files don't have any ACLs set, and destination file has group ACL.
When the file is copied using rsync from another VM, destination file ACLs are lost. Even though I am not using "-A" or by using "--no-A" ACLs are being lost.


[root@mn-0:/root]
# setfacl -m "g:wheel:rw-" /root/test.txt
[root@mn-0:/root]
# getfacl /root/test.txt
getfacl: Removing leading '/' from absolute path names
# file: root/test.txt
# owner: root
# group: root
user::rw-
group::r--
group:wheel:rw-
mask::rw-
other::r--

[root@mn-0:/root]
# rsync /tmp/dummy /root/test.txt
[root@mn-0:/root]

# getfacl /root/test.txt
getfacl: Removing leading '/' from absolute path names
# file: root/test.txt
# owner: root
# group: root
user::rw-
group::rw-
other::r--

[root@mn-0:/root]
#

=========================================


[root@mn-0:/root]
# setfacl -m "g:wheel:rw-" /root/test.txt
[root@mn-0:/root]

# getfacl /root/test.txt
getfacl: Removing leading '/' from absolute path names
# file: root/test.txt
# owner: root
# group: root
user::rw-
group::rw-
group:wheel:rw-
mask::rw-
other::r--

[root@mn-0:/root]
# rsync --no-A /tmp/dummy /root/test.txt
[root@mn-0:/root]
# getfacl /root/test.txt
getfacl: Removing leading '/' from absolute path names
# file: root/test.txt
# owner: root
# group: root
user::rw-
group::rw-
other::r--

[root@mn-0:/root]

====================================================
$ uname -a
Linux mn-0 4.14.101-1.wf29.x86_64 #1 SMP Sun Feb 17 20:39:50 EET 2019 x86_64 x86_64 x86_64 GNU/Linux
[robot@mn-0:/home/robot]

$ rsync --version
rsync  version 3.1.3  protocol version 31
Comment 1 Kevin Korb 2019-03-05 15:46:55 UTC
You have -A backwards.  If you want rsync to copy the ACLs you have to use -A.
Comment 2 Paul Slootman 2019-03-05 19:29:17 UTC
I think the point Dinesh is trying to make is that rsync is removing ACLs from the destination even though it's not asked to preserve the source's ACLs (which don't exist).

I think the problem is that rsync creates a new file on the destination. The same thing will happen to any other metadata such as group or owner, if you don't use -g or -o (the group and owner will become the user transferring the file).

Try using --inplace to update the existing file.

IMHO this is not a bug.
Comment 3 Dinesh Reddy 2019-03-06 06:46:17 UTC
(In reply to Paul Slootman from comment #2)
Thanks for the suggestion. --inplace is actually working for my case.
Our use-case is to distribute sparse file across the VMs (--sparse is being used), hopefully, this --inplace don't have any impact on --sparse option.