Bug 8726 - -x option is broken on cp(1) fileutils-4.0
Summary: -x option is broken on cp(1) fileutils-4.0
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: fileutils
Version: 6.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-01-21 20:34 UTC by Mark Lord
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-02-10 12:27:36 UTC


Attachments (Terms of Use)
This patch fixes the -x option of the cp command. (538 bytes, patch)
2000-01-21 20:34 UTC, Mark Lord
no flags Details | Diff

Description Mark Lord 2000-01-21 20:34:00 UTC
The -x (copy-one-filesystem) option does not work correctly
on the cp command.
For example:

        mkdir t
        cd t
        mkdir mntpoint
        mount some_file_system ./mntpoint
        mkdir ./mntpoint/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 @@

          if (x->verbose)
            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.  */

Comment 1 Mark Lord 2000-01-21 20:34:59 UTC
Created attachment 73 [details]
This patch fixes the -x option of the cp command.

Comment 2 Bernhard Rosenkraenzer 2000-02-07 16:35:59 UTC
Thanks, fixed.

Comment 3 Nalin Dahyabhai 2000-02-09 17:52:59 UTC
The fix in the package breaks the -r flag.

Comment 4 Bernhard Rosenkraenzer 2000-02-10 12:27:59 UTC
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...

Comment 5 Bernhard Rosenkraenzer 2000-10-05 12:21:17 UTC
It's fixed in 4.0z-1.


Note You need to log in before you can comment on or make changes to this bug.