For example, the following scenario would cyclically traverse the bind mounts until the OS (Linux in this case) hits a maximum traversal count, thank goodness. Other OSes may traverse the bind mount indefinitely...
su cd mkdir ~/cycle touch ~/cycle/file.txt mkdir ~/cycle/cycle mount -o bind ~/cycle ~/cycle/cycle rsync -avxx ~/cycle ~/cycle2Please let me if there is any feedback on this patch and when/if this patch can be merged. Thanks!
-Jeff -- //Jeff Hansen ////Card Access, Inc.// //11778 So. Election Rd., Ste. 260// //Salt Lake City, UT 84020// //[email protected]// <mailto:[email protected]> //www.CardAccess-inc.com <http://www.cardaccess-inc.com/>// //801-748-4900 ext 26 (Office)// //801-748-4901 (fax)//
--- ./rsync.1.orig 2011-01-13 11:10:23.000000000 -0700
+++ ./rsync.1 2011-01-13 11:12:37.000000000 -0700
@@ -1255,6 +1255,10 @@
the copy. Otherwise, it includes an empty directory at each mount-point it
encounters (using the attributes of the mounted directory because those of
the underlying mount-point directory are inaccessible).
+.IP
+If this option is repeated twice, rsync omits all mount-point directories,
+even if it is the same filesystem, as is potentially the case in a cyclic
+bind mount.
.IP
If rsync has been told to collapse symlinks (via \fB\-\-copy\-links\fP or
\fB\-\-copy\-unsafe\-links\fP), a symlink to a directory on another device is
--- ./rsync.yo.orig 2011-01-13 11:07:53.000000000 -0700
+++ ./rsync.yo 2011-01-13 11:12:44.000000000 -0700
@@ -1096,6 +1096,10 @@
encounters (using the attributes of the mounted directory because those of
the underlying mount-point directory are inaccessible).
+If this option is repeated twice, rsync omits all mount-point directories,
+even if it is the same filesystem, as is potentially the case in a cyclic
+bind mount.
+
If rsync has been told to collapse symlinks (via bf(--copy-links) or
bf(--copy-unsafe-links)), a symlink to a directory on another device is
treated like a mount-point. Symlinks to non-directories are unaffected
--- ./flist.c.orig 2011-01-13 10:59:03.000000000 -0700
+++ ./flist.c 2011-01-13 11:06:55.000000000 -0700
@@ -1153,9 +1153,10 @@
/* -x only affects dirs because we need to avoid recursing
* into a mount-point directory, not to avoid copying a
* symlinked file if -L (or similar) was specified. */
- if (one_file_system && st.st_dev != filesystem_dev
+ if (one_file_system
&& BITS_SETnUNSET(flags, FLAG_CONTENT_DIR, FLAG_TOP_DIR)) {
- if (one_file_system > 1) {
+ if (one_file_system > 2) {
+ofs_skip:
if (verbose > 1) {
rprintf(FINFO,
"[%s] skipping mount-point dir %s\n",
@@ -1163,8 +1164,12 @@
}
return NULL;
}
- flags |= FLAG_MOUNT_DIR;
- flags &= ~FLAG_CONTENT_DIR;
+ if (st.st_dev != filesystem_dev) {
+ if (one_file_system > 1)
+ goto ofs_skip;
+ flags |= FLAG_MOUNT_DIR;
+ flags &= ~FLAG_CONTENT_DIR;
+ }
}
} else
flags &= ~FLAG_CONTENT_DIR;
--- ./options.c.orig 2011-01-13 11:19:20.000000000 -0700
+++ ./options.c 2011-01-13 11:19:30.000000000 -0700
@@ -1808,6 +1808,8 @@
argstr[x++] = 'x';
if (one_file_system > 1)
argstr[x++] = 'x';
+ if (one_file_system > 2)
+ argstr[x++] = 'x';
}
if (sparse_files)
argstr[x++] = 'S';
smime.p7s
Description: S/MIME Cryptographic Signature
-- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
