orphan dirs and files with --delete
ewhiting at amis.com
Tue Mar 23 18:26:25 GMT 2004
Wayne Davison wrote:
> On Mon, Mar 22, 2004 at 04:49:15PM -0700, Eric Whiting wrote:
> > rsync (2.5.) --delete fails on dirs with the w bit cleared. (example below)
> > Rsync will sync a dir with w bit clear, but will not remove it with --delete.
> It's actually debatable what the correct behavior is in this case.
> Using "rm -rf" on that same directory tree would also fail, so rsync is
> currently behaving in a consistent manner with other unix/linux tools.
> I'm inclined to leave it that way.
Thanks. yes I agree with your statements... This is not a clear 'problem' nor is
there a 'right' way to fix this. Yet I think there are still reasons to change
If we depend on -a and --delete to keep sites in sync then what I have described
is a scenario where rsync can create/mirror read only dirs/files, but it will
refuse to delete them. Rsync is already doing the chmod required for the
creation of those dirs/files -- therefore the chmod for deletion is not that
inconsistent with the overall purpose of the tool.
Rsync is not emulating rm, nor other 'single' commands. Rsync is a tool that
combines features of chmod/chown/compress/gzip/tar/find/ssh/rsh/tar/etc -- that
is what makes it so useful.
I have workarounds for this issue and I can deal with it. (manual chmods,
private patch, or running as root) Running rsync as root does not have this
problem. The root user has permission to rm dirs/files with the w bit clear
(under most OSs). Yet I don't like to run these syncs as root. In this case that
just came up we had to go to the destination boxes and do some chmods. The
source files/dirs on the master site are already gone so we did not have other
simple options. Of course another fix is to keep the source tree 'clean' in not
having and files/dirs with the w bit clear for the file owner. I saw that the
CVS tree had a change regarding suid behavior. This too might be another
solution, but it is also something that I might be hesitant to use as well. (an
not sure it would fix the problem)
I think this 'small' issue will come up again. Rsync is a very useful tool that
is only gaining in popularity. I don't think I'll be the only person who will
run into this.
Just my 2cents..
More information about the rsync