Storing ownership / device nodes without root

Wesley W. Terpstra wesley at terpstra.ca
Fri Oct 27 11:37:45 GMT 2006


On Oct 27, 2006, at 9:46 AM, Wayne Davison wrote:
> http://rsync.samba.org/ftp/unpacked/rsync/patches/fake-super.diff
Does any of my patch remain?? ;-)

I don't understand the logic of clientserver.c:
         if (lp_fake_super(i))
                 am_root = -1;
         else if (am_root < 0) /* Treat --fake-super from client as -- 
super. */
                 am_root = 2;
... fake-super is never sent from the client...?

Your chmod change broke symlinks. do_chmod needs to see if the file  
is a symlink or not, but you clobbered the high bits:
                 if (am_root < 0) {
                         mode_t mode = 0666 & ~orig_umask;
                         if ((sxp->st.st_mode & CHMOD_BITS) != mode)
                                 ret = do_chmod(fname, mode);
                         else
                                 ret = 0;
                         sxp->st.st_mode = new_mode;
                 } else
This makes a ton of errors when lchmod is unavailable.

In do_*stat, I would consider a failure to get_stat_xattr to be  
critical. That doesn't mean a setting was missing, it meant a setting  
was corrupt! The current return value is ignored.

When I use lsetxattr on a symlink, I get EPERM:
	rsync: write of stat xattr failed for "/kiwi-test/man/man3/wunctrl. 
3x" (in backup): Operation not permitted (1)
	rsync: write of stat xattr failed for "/kiwi-test/man/man3/wvline. 
3x" (in backup): Operation not permitted (1)
	rsync: write of stat xattr failed for "/kiwi-test/man/man3/ 
wvline_set.3x" (in backup): Operation not permitted (1)
This is linux-2.4.20 on an embedded device with ext3.
I also tried linux-2.6.18 with ext3 and xfs, same problem.
osx has no problems with this; it happily puts xattrs on symlink.
There's nothing we can do to fix this, so perhaps it should be silenced?
ie: symlink + EPERM = continue

When trying to set the xattr on a read-only file, I get EACESS.
In your patch, you moved the set_stat_xattr to after the chmod -->  
breaks if umask omits write access.
Also, something else sets the file mode, and because you have a  
difference test wrapping the chmod change, it doesn't always reset it:

kiwiw:~ terpstra$ mkdir demo
kiwiw:~ terpstra$ touch demo/bar
kiwiw:~ terpstra$ chmod 0555 demo
kiwiw:~ terpstra$ rsync -aX demo pumpkin::backup/kiwi-test
rsync: write of stat xattr failed for "/kiwi-test/demo" (in backup):  
Permission denied (13)
rsync error: some files could not be transferred (code 23) at main.c 
(717)
kiwiw:~ terpstra$ touch demo2
kiwiw:~ terpstra$ chmod 0400 demo2
kiwiw:~ terpstra$ rsync -aX demo2 pumpkin::backup/kiwi-test
rsync: write of stat xattr failed for "/.kiwi-test.vLQSce" (in  
backup): Permission denied (13)
rsync error: some files could not be transferred (code 23) at main.c 
(717)

I think the whole chmod handling is broken right now. What was your  
intention with that change? Make all files have the same file-system  
mode? If so, remove the difference test before the chmod.

Finally, the biggest bug: the permissions/device info/etc doesn't  
make it back!
All my changes to flist.c went lost --> no restore possible.
Presumably this is because you moved the reading into do_(l)stat, but  
link_stat doesn't get affected (nor does fstat).



More information about the rsync mailing list