Bug 15393 - rsync attempts to set extended attributes while in dry-run
Summary: rsync attempts to set extended attributes while in dry-run
Status: NEW
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.2.0
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-10 12:33 UTC by Miguel Ángel Prosper
Modified: 2023-06-10 12:33 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 Miguel Ángel Prosper 2023-06-10 12:33:44 UTC
Using the following system:
Debian 11 with rsync 3.2.3
Fedora 38 with rsync 3.2.7

Creating the following environment:
mkdir -p src/x cmp/x dst/
setfattr -n user.foo -v bar cmp/x

Executing the following command:
rsync --recursive --xattrs --dry-run --compare-dest=../cmp/ src/ dst/

Results in the following error:
rsync: [generator] copy_xattrs: lsetxattr("/home/user/dst/x","user.foo") failed: No such file or directory (2)

The issue only seems to occur if:
x is a directory (inside another, not as a direct argument)
--recursive, --xattrs and --dry-run are set
--compare-dest, --copy-dest or --link-dest are set

The error seems to come from:
source file generator.c in function recv_generator (line 1489)
https://github.com/WayneD/rsync/blob/v3.2.7/generator.c#L1489

The error seems to be either:
recv_generator (in generator.c) calling copy_xattrs when it should not
or
copy_xattrs (in xattrs.c) / sys_lsetxattr (in lib/sysxattrs.c) not checking the dry-run flag similarly to the functions in syscall.c do