On Oct 28, 2006, at 12:58 AM, Wayne Davison wrote:
Yeah, the error checking is not up-to-snuff yet.

Sorry, when you said you'd checked it in, I assumed that meant you were done with it and the final version was committed.

Now I've seen:
http://archives.free.net.ph/thread/ 20061028.062640.ffddea90.en.html#20061028.062640.ffddea90 that nothing could be farther from the truth, and you don't sleep at all!

When I use lsetxattr on a symlink, I get EPERM:

Me too. I currently have symlinks disabled so that we never try to set
the xattr-stat value.  It might be better to just silence the error in
the future.

Since xattr on osx symlinks succeeds, that seems the better choice.

The latest code
ensures that the umask can't ask to restrict the file-owner's
permissions, so this will not happen (and I went ahead and moved the
set_stat_xattr() call up higher, just in case the ACL settings mess
things up).

Right. That's a good idea.

Thanks for the feedback, and please feel free to offer more hints,
criticisms, and/or patches.

I would send patches, but I find it quite difficult to get patches against patches.
Is there some sort of script you're using to do this?
For that matter, how are you keeping such a large patchset consistent when you modify cvs??


Anyway, I just did a number of tests using --link-dest together with --fake-super (this being the eventual goal after all!)

I created these directories:
kiwiw:~/rsync/tests terpstra$ ls -l base mod
base:
total 20
-rw-r--r--    1 root     terpstra        6 Oct 28 16:40 chgrp
-rw-r--r-- 1 root terpstra 6 Oct 28 16:40 chmod-high- bits-change -rw-r--r-- 1 root terpstra 6 Oct 28 16:40 chmod-low- bits-change
-rw-r--r--    1 root     terpstra        6 Oct 28 16:40 chown
-rw-r--r--    1 root     terpstra        0 Oct 28 16:40 deleted-file
brw-r--r-- 1 root terpstra 14, 6 Oct 28 16:40 device- becomes-file
brw-r--r--    1 root     terpstra  14,   6 Oct 28 16:40 device-changes
-rw-r--r-- 1 root terpstra 0 Oct 28 16:40 file-becomes- device -rw-r--r-- 1 root terpstra 0 Oct 28 16:40 file-becomes- symlink lrwxr-xr-x 1 root terpstra 7 Oct 28 16:40 symlink- becomes-file -> nowhere
-rw-r--r--    1 root     terpstra        5 Oct 28 16:40 unchanged-file

mod:
total 20
-rw-r--r--    1 root     bin             6 Oct 28 16:40 chgrp
-rw-r--r-T 1 root terpstra 6 Oct 28 16:40 chmod-high- bits-change -rw-r--rw- 1 root terpstra 6 Oct 28 16:40 chmod-low- bits-change
-rw-r--r--    1 www      terpstra        6 Oct 28 16:40 chown
-rw-r--r--    1 root     terpstra        0 Oct 28 16:40 created-file
-rw-r--r-- 1 root terpstra 0 Oct 28 16:40 device- becomes-file
brw-r--r--    1 root     terpstra  14,   7 Oct 28 16:40 device-changes
brw-r--r-- 1 root terpstra 14, 6 Oct 28 16:40 file-becomes- device lrwxr-xr-x 1 root terpstra 7 Oct 28 16:40 file-becomes- symlink -> nowhere -rw-r--r-- 1 root terpstra 0 Oct 28 16:40 symlink- becomes-file
-rw-r--r--    1 root     terpstra        5 Oct 28 16:40 unchanged-file

Then sync'd them to the remote end and back with:
kiwiw:~/rsync/tests terpstra$ sudo rsync -a base/ pumpkin::backup/ test/base kiwiw:~/rsync/tests terpstra$ sudo rsync -a --link-dest=../base mod/ pumpkin::backup/test/mod kiwiw:~/rsync/tests terpstra$ sudo rsync -a pumpkin::backup/test/mod/ mod2

As hoped, the only file on the remote end with a common inode was 'unchanged-file':
pumpkin:/backup# ls -li test/base test/mod
test/base:
total 60
25231365 -rw-r--r--    1 backup   root            6 Oct 28 16:40 chgrp
25231366 -rw-r--r-- 1 backup root 6 Oct 28 16:40 chmod-high-bits-change 25231367 -rw-r--r-- 1 backup root 6 Oct 28 16:40 chmod-low-bits-change
25231368 -rw-r--r--    1 backup   root            6 Oct 28 16:40 chown
25231369 -rw-r--r-- 1 backup root 0 Oct 28 16:40 deleted-file 25231362 -rw-r--r-- 1 backup root 0 Oct 28 16:40 device-becomes-file 25231363 -rw-r--r-- 1 backup root 0 Oct 28 16:40 device-changes 25231370 -rw-r--r-- 1 backup root 0 Oct 28 16:40 file- becomes-device 25231371 -rw-r--r-- 1 backup root 0 Oct 28 16:40 file- becomes-symlink 25231364 lrwxrwxrwx 1 backup root 7 Oct 28 16:59 symlink-becomes-file -> nowhere 25231372 -rw-r--r-- 2 backup root 5 Oct 28 16:40 unchanged-file

test/mod:
total 60
25264130 -rw-r--r--    1 backup   root            6 Oct 28 16:40 chgrp
25264131 -rw-r--r-- 1 backup root 6 Oct 28 16:40 chmod-high-bits-change 25264132 -rw-r--rw- 1 backup root 6 Oct 28 16:40 chmod-low-bits-change
25264133 -rw-r--r--    1 backup   root            6 Oct 28 16:40 chown
25264137 -rw-r--r-- 1 backup root 0 Oct 28 16:40 created-file 25264138 -rw-r--r-- 1 backup root 0 Oct 28 16:40 device-becomes-file 25264134 -rw-r--r-- 1 backup root 0 Oct 28 16:40 device-changes 25264135 -rw-r--r-- 1 backup root 0 Oct 28 16:40 file- becomes-device 25264136 lrwxrwxrwx 1 backup root 7 Oct 28 16:59 file- becomes-symlink -> nowhere 25264139 -rw-r--r-- 1 backup root 0 Oct 28 16:40 symlink-becomes-file 25231372 -rw-r--r-- 2 backup root 5 Oct 28 16:40 unchanged-file

Also, it exposed the correct low-bit chmod changes, while masking out the high bits.

Back on the local machine, the restore worked perfectly (except for symlinks - grrr!):
kiwiw:~/rsync/tests terpstra$ ls -l mod mod2
mod:
total 20
-rw-r--r--    1 root     bin             6 Oct 28 16:40 chgrp
-rw-r--r-T 1 root terpstra 6 Oct 28 16:40 chmod-high- bits-change -rw-r--rw- 1 root terpstra 6 Oct 28 16:40 chmod-low- bits-change
-rw-r--r--    1 www      terpstra        6 Oct 28 16:40 chown
-rw-r--r--    1 root     terpstra        0 Oct 28 16:40 created-file
-rw-r--r-- 1 root terpstra 0 Oct 28 16:40 device- becomes-file
brw-r--r--    1 root     terpstra  14,   7 Oct 28 16:40 device-changes
brw-r--r-- 1 root terpstra 14, 6 Oct 28 16:40 file-becomes- device lrwxr-xr-x 1 root terpstra 7 Oct 28 16:40 file-becomes- symlink -> nowhere -rw-r--r-- 1 root terpstra 0 Oct 28 16:40 symlink- becomes-file
-rw-r--r--    1 root     terpstra        5 Oct 28 16:40 unchanged-file

mod2:
total 20
-rw-r--r--    1 root     bin             6 Oct 28 16:40 chgrp
-rw-r--r-T 1 root terpstra 6 Oct 28 16:40 chmod-high- bits-change -rw-r--rw- 1 root terpstra 6 Oct 28 16:40 chmod-low- bits-change
-rw-r--r--    1 www      terpstra        6 Oct 28 16:40 chown
-rw-r--r--    1 root     terpstra        0 Oct 28 16:40 created-file
-rw-r--r-- 1 root terpstra 0 Oct 28 16:40 device- becomes-file
brw-r--r--    1 root     terpstra  14,   7 Oct 28 16:40 device-changes
brw-r--r-- 1 root terpstra 14, 6 Oct 28 16:40 file-becomes- device lrwxrwxrwx 1 1001 wheel 7 Oct 28 17:02 file-becomes- symlink -> nowhere -rw-r--r-- 1 root terpstra 0 Oct 28 16:40 symlink- becomes-file
-rw-r--r--    1 root     terpstra        5 Oct 28 16:40 unchanged-file

I also tried the same tests without --fake-super. In that case, the files chown and chgrp also share an inode. The sticky bit was exposed, and symlink permissions were still broken.

Conclusion: it works! (mostly)

The only regression I saw over the normal rsync behaviour is the strange change to the symlink owner. I imagine this is because we fail to store the owner in the xattr of the symlink (target machine is linux), and on the way back we therefore use the owner of the file on the --fake-super machine (1001 in this case). The local end, having real root, happily sets the symlink owner to 1001, which is wrong.

Do you see anything else?

--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to