Red Hat Bugzilla – Bug 8726
-x option is broken on cp(1) fileutils-4.0
Last modified: 2008-05-01 11:37:54 EDT
The -x (copy-one-filesystem) option does not work correctly
on the cp command.
mount some_file_system ./mntpoint
cp -auvfx . mntpoint
And watch it recurse, copying the contents of mntpoint to itself,
even though -x was supposed to prevent this from happening.
This appears due to a misplaced closing curly bracket in copy.c,
and is fixable by the following patch. Bug report also sent to GNU.
--- fileutils-4.0/src/copy.c.orig Mon Sep 28 12:09:18 1998
+++ fileutils-4.0/src/copy.c Fri Jan 21 15:27:07 2000
@@ -668,11 +668,11 @@
printf ("%s -> %s\n", src_path, dst_path);
- /* Are we crossing a file system boundary? */
- if (x->one_file_system && device != 0 && device != src_sb.st_dev)
- return 0;
+ /* Are we crossing a file system boundary? */
+ if (x->one_file_system && device != 0 && device != src_sb.st_dev)
+ return 0;
/* Copy the contents of the directory. */
Created attachment 73 [details]
This patch fixes the -x option of the cp command.
The fix in the package breaks the -r flag.
I've taken out the patch for now - didn't have the time to fix it properly yet,
and -r is more important than -x...
It's fixed in 4.0z-1.