samba-bugs at samba.org
2009-Sep-23  02:29 UTC
DO NOT REPLY [Bug 6752] New: --force option doesn't work as expected/documented
https://bugzilla.samba.org/show_bug.cgi?id=6752
           Summary: --force option doesn't work as expected/documented
           Product: rsync
           Version: 3.0.6
          Platform: x64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: core
        AssignedTo: wayned at samba.org
        ReportedBy: ciolfi at mathworks.com
         QAContact: rsync-qa at samba.org
Run following script and you'll receive:
cannot delete non-empty directory: s1/CVS
delete non-empty directory: s1/CVS
cannot delete non-empty directory: s1
which conflicts with the doc on --force. Googling this also brings up a number
of others with the same problem. The source of the problem is the exclude
filter. 
-------------------- force_bug.sh -----
#!/bin/csh
# Reproduction steps where --force doesn't force deletion.
rm -rf src dst
mkdir -p dst/s1/CVS
echo foo > dst/s1/CVS/Root
mkdir -p src/s2/foo.txt
rsync -az --filter='exclude, /**/CVS/Root' --filter='protect,
/**/CVS/Root'
--fo
rce --delete --delete-excluded src/ dst
-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
samba-bugs at samba.org
2009-Sep-23  02:50 UTC
DO NOT REPLY [Bug 6752] --force option doesn't work as expected/documented
https://bugzilla.samba.org/show_bug.cgi?id=6752
matt at mattmccutchen.net changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
------- Comment #1 from matt at mattmccutchen.net  2009-09-22 21:50 CST -------
The current behavior is correct according to the long description in the man
page:
--force
This option tells rsync to delete a non-empty directory when it is to be
replaced by a non-directory.
The short documentation, "force deletion of dirs even if not empty",
is
misleading.  I suggest changing it to "OK to replace non-empty dirs with
non-dirs" (just under the length limit).
ciolfi, if you don't want protected destination files to pin their ancestor
directories, you need to use the "P" filter modifier.
-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
samba-bugs at samba.org
2009-Sep-23  03:00 UTC
DO NOT REPLY [Bug 6752] --force option doesn't work as expected/documented
https://bugzilla.samba.org/show_bug.cgi?id=6752 ------- Comment #2 from matt at mattmccutchen.net 2009-09-22 22:00 CST ------- Created an attachment (id=4730) --> (https://bugzilla.samba.org/attachment.cgi?id=4730&action=view) Fix the --force documentation Note: This will cause a conflict in fileflags.diff. -- Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug, or are watching the QA contact.
samba-bugs at samba.org
2009-Sep-23  03:08 UTC
DO NOT REPLY [Bug 6752] --force option doesn't work as expected/documented
https://bugzilla.samba.org/show_bug.cgi?id=6752
matt at mattmccutchen.net changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|wayned at samba.org            |matt at mattmccutchen.net
             Status|ASSIGNED                    |NEW
------- Comment #3 from matt at mattmccutchen.net  2009-09-22 22:08 CST -------
Incidentally, I don't like the name --force; it is really inadequate as a
description (or even reminder) of the associated behavior.  fileflags.diff
renames the option to --force-delete, but that sounds stronger than --delete,
which it isn't.  --replace-dirs is pretty good but doesn't cover the
interaction with --delete-missing-args.  --clobber-dirs is better there but may
be too silly.
-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
samba-bugs at samba.org
2009-Sep-23  13:30 UTC
DO NOT REPLY [Bug 6752] --force option doesn't work as expected/documented
https://bugzilla.samba.org/show_bug.cgi?id=6752 ------- Comment #4 from ciolfi at mathworks.com 2009-09-23 08:30 CST ------- Thanks for the "p" modifier tip. That solves the problem. May I suggest that if you are updating the documentation that you also note that the "p" modifier can be applied to the protect rules. Here's the example that does work (which may be worth adding to a FAQ): mkdir -p dst/s1/CVS echo foo > dst/s1/CVS/Root mkdir -p src/s2/foo.txt rsync -az --filter='exclude /**/CVS/Root' --filter='protect,p /**/CVS/Root' --delete-excluded src/ dst The scenario is that I'm copying a CVS source tree from a src location to a dst location. The contents of the CVS/Root file needs to be different in the destination, therefore we exclude them from the rsync transfer and after the rsync is complete create the desired CVS/Root files. On a 2nd rsync, we don't want the CVS/Root files touched, thus we use the protect rule. However, we need to use the p modifier for the protect rule such that we can delete the files when the directory tree is no longer present on the src side. Thanks John -- Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug, or are watching the QA contact.
Maybe Matching Threads
- DO NOT REPLY [Bug 6893] New: the symbolic link to the directory is gone when only some of the files are to be sync'ed
- DO NOT REPLY [Bug 7321] New: Extend "p" filter modifier to make source dirs prunable
- DO NOT REPLY [Bug 6197] New: Perms/owner/group modifiers for "show" filters
- DO NOT REPLY [Bug 7450] New: When a single file is specified, the exclusion of it in the exclude-from file is ignored
- DO NOT REPLY [Bug 6276] New: crtimes.patch does not preserve creation dates on Mac x86_64 only