Re: orphan dirs and files with --delete
Wayne Davison wrote: > > On Mon, Mar 22, 2004 at 04:49:15PM -0700, Eric Whiting wrote: > > rsync (2.5.[67]) --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. Wayne, 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 this behavior. 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.. eric -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: orphan dirs and files with --delete
On Mon, Mar 22, 2004 at 04:49:15PM -0700, Eric Whiting wrote: > rsync (2.5.[67]) --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. ..wayne.. -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: orphan dirs and files with --delete
I still get the same error with --force --delete. There needs to be a chmod on dir before the files and dir can be deleted. eric Tim Conway wrote: > > --force force deletion of directories even if > not empty > > SunOS 5.8 Last change: 26 Jan 20037 > > User Commandsrsync(1) > > That should do it. > > Tim Conway > Unix System Administration > Contractor - IBM Global Services > desk:3032734776 > [EMAIL PROTECTED] > > rsync (2.5.[67]) --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. > > This is not a big problem, but it will create situations where there are > 'orphaned' files. > > Has anyone else had this problem? > > It looks like a change would be needed in robust_unlink (util.c). This > function > would have to do a chmod on dirs that are locked down before it does the > unlink. > (syncing as user root doesn't have this problem) > > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: orphan dirs and files with --delete
--force force deletion of directories even if not empty SunOS 5.8 Last change: 26 Jan 20037 User Commandsrsync(1) That should do it. Tim Conway Unix System Administration Contractor - IBM Global Services desk:3032734776 [EMAIL PROTECTED] rsync (2.5.[67]) --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. This is not a big problem, but it will create situations where there are 'orphaned' files. Has anyone else had this problem? It looks like a change would be needed in robust_unlink (util.c). This function would have to do a chmod on dirs that are locked down before it does the unlink. (syncing as user root doesn't have this problem) -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
orphan dirs and files with --delete
rsync (2.5.[67]) --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. This is not a big problem, but it will create situations where there are 'orphaned' files. Has anyone else had this problem? It looks like a change would be needed in robust_unlink (util.c). This function would have to do a chmod on dirs that are locked down before it does the unlink. (syncing as user root doesn't have this problem) The CHECK_RO macro in syscall.c only checks for file being RO. It doesn't check for the dir being RO. eric here is an example: COMMANDS: -- cd /tmp # cleanup chmod -R a+w source dest rm -rf source dest # create a dir and subdir and chmod mkdir source cd source touch file1 file2 mkdir dir1;touch dir1/file3 dir1/file4 chmod a-w dir1 # rsync to dest mkdir /tmp/dest rsync --delete -av /tmp/source/ /tmp/dest # clean up source a little bit chmod a+w dir1 rm -rf dir1 # attempt to clean up dest with rsync (this --delete will fail) rsync --delete -av /tmp/source/ /tmp/dest cd /tmp OUTPUT (of final rsync) --- /tmp/source> rsync --delete -av /tmp/source/ /tmp/dest building file list ... done delete_one: unlink dir1/file4: Permission denied delete_one: unlink dir1/file3: Permission denied ./ wrote 102 bytes read 20 bytes 244.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files could not be transferred (code 23) at main.c(620) -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html