Bug 8726 - -x option is broken on cp(1) fileutils-4.0
-x option is broken on cp(1) fileutils-4.0
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: fileutils (Show other bugs)
6.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-01-21 15:34 EST by Mark Lord
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-02-10 07:27:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Mark Lord 2000-01-21 15:34:00 EST
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 15:34:59 EST
Created attachment 73 [details]
This patch fixes the -x option of the cp command.
Comment 2 Bernhard Rosenkraenzer 2000-02-07 11:35:59 EST
Thanks, fixed.
Comment 3 Nalin Dahyabhai 2000-02-09 12:52:59 EST
The fix in the package breaks the -r flag.
Comment 4 Bernhard Rosenkraenzer 2000-02-10 07:27:59 EST
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 08:21:17 EDT
It's fixed in 4.0z-1.

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