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)
--force force deletion of directories even if not empty SunOS 5.8 Last change: 26 Jan 2003 7 User Commands rsync(1) That should do it. Tim Conway Unix System Administration Contractor - IBM Global Services desk:3032734776 conway@us.ibm.com 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)
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..