samba-bugs@samba.org
2008-Jun-25 05:27 UTC
DO NOT REPLY [Bug 5565] New: xattrs not set on locked files that already exist on target
https://bugzilla.samba.org/show_bug.cgi?id=5565
Summary: xattrs not set on locked files that already exist on
target
Product: rsync
Version: 3.0.3
Platform: Other
OS/Version: Mac OS X
Status: NEW
Severity: normal
Priority: P3
Component: core
AssignedTo: wayned@samba.org
ReportedBy: mike@bombich.com
QAContact: rsync-qa@samba.org
It appears that rsync isn't unlocking files before setting the file
attributes
when those files already exist. This generates error messages on subsequent
backups such as:
rsync: rsync_xal_set: lsetxattr("locked_file","test_xattr")
failed: Operation
not permitted (1)
rsync: rsync_xal_clear:
lremovexattr("locked_file","test_xattr.temp") failed:
Operation not permitted (1)
I assume this would also affect ACLs. Presumably, this is what --force-change
is supposed to do, so I extended that functionality to apply to this test case.
Here's the test case (tested on 3.0.3pre3+fileflags+crtime):
######
#!/bin/sh
xattr=/usr/local/bin/xattr
rsync="/Users/bombich/Desktop/rsync-HEAD-20080412-0558GMT/rsync"
src=`mktemp -d /tmp/src.XXXXXX`
tgt=`mktemp -d /tmp/tgt.XXXXXX`
touch $src/locked_file
$xattr -s test_xattr "Test attribute" $src/locked_file
$xattr -s test_xattr.temp "Temp attribute" $src/locked_file
chflags uchg $src/locked_file
## First backup
printf "### Initial backup ###\n\n"
"$rsync" -vaX --fileflags --force-change $src/ $tgt/
## Change the source file
chflags nouchg $src/locked_file
$xattr -s test_xattr "Modified attribute" $src/locked_file
$xattr -d test_xattr.temp $src/locked_file
chflags uchg $src/locked_file
## Second backup
printf "\n### Second backup ###\n\n"
"$rsync" -vaX --fileflags --force-change $src/ $tgt/
# Cleanup
chflags -R nouchg $src
chflags -R nouchg $tgt
rm -rf $src $tgt
######
Example output:
[bombich:~] ~/Desktop/locked_xattrs.sh
### Initial backup ###
sending incremental file list
locked_file
sent 173 bytes received 32 bytes 410.00 bytes/sec
total size is 0 speedup is 0.00
### Second backup ###
sending incremental file list
rsync: rsync_xal_set: lsetxattr("locked_file","test_xattr")
failed: Operation
not permitted (1)
rsync: rsync_xal_clear:
lremovexattr("locked_file","test_xattr.temp") failed:
Operation not permitted (1)
sent 104 bytes received 16 bytes 240.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files could not be transferred (code 23) at main.c(1031)
[sender=3.0.3dev]
PATCH:
diff -Naur rsync-3.0.3pre3_base/rsync.c rsync-3.0.3pre3_patched/rsync.c
--- rsync-3.0.3pre3_base/rsync.c 2008-06-23 22:31:58.000000000 -0700
+++ rsync-3.0.3pre3_patched/rsync.c 2008-06-23 22:59:03.000000000 -0700
@@ -31,6 +31,7 @@
extern int dry_run;
extern int preserve_acls;
extern int preserve_xattrs;
+extern int force_change;
extern int preserve_perms;
extern int preserve_fileflags;
extern int preserve_executability;
@@ -445,6 +446,11 @@
if (daemon_chmod_modes && !S_ISLNK(new_mode))
new_mode = tweak_mode(new_mode, daemon_chmod_modes);
+#ifdef SUPPORT_FORCE_CHANGE
+ if (force_change)
+ make_mutable(fname, sxp->st.st_mode, sxp->st.st_flags,
force_change);
+#endif
+
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode) &&
!ACL_READY(*sxp))
get_acl(fname, sxp);
## Note: I'm not using undo_make_mutable because set_fileflags is called at
the
end of this method if we care about fileflags.
--
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
samba-bugs@samba.org
2008-Jun-30 03:51 UTC
DO NOT REPLY [Bug 5565] xattrs not set on locked files that already exist on target
https://bugzilla.samba.org/show_bug.cgi?id=5565
wayned@samba.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
------- Comment #1 from wayned@samba.org 2008-06-29 22:51 CST -------
Yeah, this is a known issue with immutable files. I'll be considering your
patch for inclusion in an upcoming version. Thanks!
--
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
samba-bugs at samba.org
2014-Aug-11 15:45 UTC
[Bug 5565] xattrs not set on locked files that already exist on target
https://bugzilla.samba.org/show_bug.cgi?id=5565
Ruben Kerkhof <ruben at rubenkerkhof.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ruben at rubenkerkhof.com
--- Comment #2 from Ruben Kerkhof <ruben at rubenkerkhof.com> 2014-08-11
15:45:31 UTC ---
Just a friendly reminder to please apply this patch. This is still an issue
with 3.1.1 on OSX.
--
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.