From unknown Tue Jun 17 01:42:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8636: cp -x flag does not work Resent-From: obb33@verizon.net Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 07 May 2011 20:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8636 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8636@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.130479930820705 (code B ref -1); Sat, 07 May 2011 20:16:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 May 2011 20:15:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QInu8-0005Nt-6U for submit@debbugs.gnu.org; Sat, 07 May 2011 16:15:08 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QImgB-0003iy-CI for submit@debbugs.gnu.org; Sat, 07 May 2011 14:56:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QImg5-00008b-Jw for submit@debbugs.gnu.org; Sat, 07 May 2011 14:56:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RFC_ABUSE_POST, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:37808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QImg5-00008X-IL for submit@debbugs.gnu.org; Sat, 07 May 2011 14:56:33 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QImg4-0001at-JG for bug-coreutils@gnu.org; Sat, 07 May 2011 14:56:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QImg3-00008H-Gh for bug-coreutils@gnu.org; Sat, 07 May 2011 14:56:32 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]:42422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QImg3-00007t-Dc for bug-coreutils@gnu.org; Sat, 07 May 2011 14:56:31 -0400 Received: from prism2.prism ([unknown] [108.25.20.12]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LKU004UI75NTHU6@vms173003.mailsrvcs.net> for bug-coreutils@gnu.org; Sat, 07 May 2011 12:56:12 -0500 (CDT) Received: from prism.prism (prism [10.0.0.11]) by prism2.prism (8.14.3/8.14.2) with ESMTP id p47HuCcr010750 for ; Sat, 07 May 2011 13:56:12 -0400 Received: (from kutek@localhost) by prism.prism (8.11.6/8.11.1) id p47GpYh05331 for bug-coreutils@gnu.org; Sat, 07 May 2011 12:51:34 -0400 X-Authentication-warning: prism.prism: kutek set sender to obb33@verizon.net using -f Date: Sat, 07 May 2011 12:51:31 -0400 From: obb33@verizon.net Message-id: <20110507165131.GA4102@verizon.net> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.4.2.1i X-detected-operating-system: by eggs.gnu.org: Solaris 10 (1203?) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Mailman-Approved-At: Sat, 07 May 2011 16:15:06 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) coreutils 8.12, i don't know if this problem existed in previous versions. copying the root directory ( / ) of a running linux system using cp -xdvpR cp followed a directory that was mounted via NFS under / . the copy was stopped before any other directories on other filesystems were copied so i can't speak about how cp would handle those mounts. fractoid From unknown Tue Jun 17 01:42:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8636: cp -x flag does not work Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 08 May 2011 17:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8636 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: obb33@verizon.net Cc: 8636@debbugs.gnu.org Received: via spool by 8636-submit@debbugs.gnu.org id=B8636.13048759362862 (code B ref 8636); Sun, 08 May 2011 17:33:02 +0000 Received: (at 8636) by debbugs.gnu.org; 8 May 2011 17:32:16 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QJ7q3-0000k7-Fq for submit@debbugs.gnu.org; Sun, 08 May 2011 13:32:15 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QJ7q2-0000jw-3D for 8636@debbugs.gnu.org; Sun, 08 May 2011 13:32:15 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 87A89601D4; Sun, 8 May 2011 19:32:08 +0200 (CEST) From: Jim Meyering In-Reply-To: <20110507165131.GA4102@verizon.net> (obb's message of "Sat, 07 May 2011 12:51:31 -0400") References: <20110507165131.GA4102@verizon.net> Date: Sun, 08 May 2011 19:32:08 +0200 Message-ID: <87iptldron.fsf@rho.meyering.net> Lines: 34 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.0 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) obb33@verizon.net wrote: > coreutils 8.12, i don't know if this problem existed in previous versions. > > copying the root directory ( / ) of a running linux system using cp -xdvpR > cp followed a directory that was mounted via NFS under / . the copy was > stopped before any other directories on other filesystems were copied so i > can't speak about how cp would handle those mounts. tags 8636 + moreinfo thanks Thanks for the report. AFAIK, cp's -x (--one-file-system) option does work. If it's not working for you, perhaps there is something unusual about your situation. What does "df" say about the NFS-mounted directory that was mistakenly copied? To test it without copying data unnecessarily, I ran this: mkdir junk && cp -srx / junk That makes symlinks to the same files that a one-file-system "cp" would have copied. The only nonempty directories in junk/ correspond to ones in "/" that reside on the same file system as "/". So at least for me, it works as advertised. Note that copying each top-level mount point directory is expected -- those are all empty in the destination (junk/ in my case). Please provide more details, including - the precise command you ran - a sample of the output showing it copying a file that it shouldn't - what this prints: stat --format=%04D:%n / DIR where DIR is an NFS-mounted directory that was mistakenly copied From unknown Tue Jun 17 01:42:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8636: cp -x flag does not work Resent-From: obb33@verizon.net Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 09 May 2011 11:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8636 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8636@debbugs.gnu.org Received: via spool by 8636-submit@debbugs.gnu.org id=B8636.130494183314506 (code B ref 8636); Mon, 09 May 2011 11:51:01 +0000 Received: (at 8636) by debbugs.gnu.org; 9 May 2011 11:50:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QJOyv-0003lv-FU for submit@debbugs.gnu.org; Mon, 09 May 2011 07:50:33 -0400 Received: from vms173005pub.verizon.net ([206.46.173.5]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QJOyt-0003li-FU for 8636@debbugs.gnu.org; Mon, 09 May 2011 07:50:32 -0400 Received: from prism2.prism ([unknown] [108.25.51.225]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LKX00BF9FK0MVFH@vms173005.mailsrvcs.net> for 8636@debbugs.gnu.org; Mon, 09 May 2011 06:50:25 -0500 (CDT) Received: from prism.prism (prism [10.0.0.11]) by prism2.prism (8.14.3/8.14.2) with ESMTP id p49BoPD1009719 for <8636@debbugs.gnu.org>; Mon, 09 May 2011 07:50:25 -0400 Received: (from kutek@localhost) by prism.prism (8.11.6/8.11.1) id p49Ajbv08841 for 8636@debbugs.gnu.org; Mon, 09 May 2011 06:45:37 -0400 X-Authentication-warning: prism.prism: kutek set sender to obb33@verizon.net using -f Date: Mon, 09 May 2011 06:45:34 -0400 From: obb33@verizon.net Message-id: <20110509104534.GA8147@verizon.net> References: <20110507165131.GA4102@verizon.net> <87iptldron.fsf@rho.meyering.net> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline In-reply-to: <87iptldron.fsf@rho.meyering.net> User-Agent: Mutt/1.4.2.1i X-Spam-Score: -4.3 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.7 (---) context: copy a linux system to a directory where, after chrooting to that directory, i could safely torture and mangle the duplicate system. the command used was cp -xvdpR /* /newdirectory where / contains mounted other(not on the drive / is on) filesystems. these are nfs mounts(direct and via ssh), mounted hard drives, and mounted loop drives. the guilty party is apparently the wildcard the command as given above copies everything and descends all directories on all mounted file systems under / no matter what they are. the command: cp -xvdp //* /newdirectory descends into the top level of the otherfs dir and copies the files therein, but does not descend into other directories. so the wildcard essentially negates -x and this was not anticipated behavior. checking the docs i did not find any mention of this. if this is WAD, then it should be documented, however, i don't think that someone using the -x wants a wildcard to undo that spec especially in a dir with several mounts on subdirectories. however, it is also probably the case that most people wouldn't put a wildcard in there to do the job anyway(given a -R)...but i'm weird :-) (well, actually, i thought that it would copy the / itself which would be a mess, but there may be other situations where it's use is warranted ). the latter part of the above comment suggests that i have to test what happens when using ? wildcards. the command: cp -xvdpR /mnt1? /newdir where there are mounted drives on /mnt1, /mnt11,/mnt12, descended into and copied everything on all 3 fs. without the -R flag the 3 directories were excluded. i didn't provide the items you requested because in the context of the above discoveries i didn't think it was relevant, this happens no matter what the drives are. any other info you need or testing done, let me know, and thanks fractoid On Sun, May 08, 2011 at 07:32:08PM +0200, Jim Meyering wrote: > obb33@verizon.net wrote: > > coreutils 8.12, i don't know if this problem existed in previous versions. > > > > copying the root directory ( / ) of a running linux system using cp -xdvpR > > cp followed a directory that was mounted via NFS under / . the copy was > > stopped before any other directories on other filesystems were copied so i > > can't speak about how cp would handle those mounts. > > tags 8636 + moreinfo > thanks > > Thanks for the report. > > AFAIK, cp's -x (--one-file-system) option does work. > If it's not working for you, perhaps there is something > unusual about your situation. What does "df" say about > the NFS-mounted directory that was mistakenly copied? > > To test it without copying data unnecessarily, I ran this: > > mkdir junk && cp -srx / junk > > That makes symlinks to the same files that a one-file-system "cp" would > have copied. The only nonempty directories in junk/ correspond to ones > in "/" that reside on the same file system as "/". So at least for me, > it works as advertised. Note that copying each top-level mount point > directory is expected -- those are all empty in the destination (junk/ > in my case). > > Please provide more details, including > - the precise command you ran > - a sample of the output showing it copying a file that it shouldn't > - what this prints: stat --format=%04D:%n / DIR > where DIR is an NFS-mounted directory that was mistakenly copied From unknown Tue Jun 17 01:42:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8636: cp -x flag does not work Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 09 May 2011 12:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8636 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: obb33@verizon.net Cc: 8636@debbugs.gnu.org Received: via spool by 8636-submit@debbugs.gnu.org id=B8636.130494287815931 (code B ref 8636); Mon, 09 May 2011 12:08:02 +0000 Received: (at 8636) by debbugs.gnu.org; 9 May 2011 12:07:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QJPFm-00048u-0Z for submit@debbugs.gnu.org; Mon, 09 May 2011 08:07:58 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QJPFj-00048h-TY for 8636@debbugs.gnu.org; Mon, 09 May 2011 08:07:56 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id E8D096014D; Mon, 9 May 2011 14:07:49 +0200 (CEST) From: Jim Meyering In-Reply-To: <20110509104534.GA8147@verizon.net> (obb's message of "Mon, 09 May 2011 06:45:34 -0400") References: <20110507165131.GA4102@verizon.net> <87iptldron.fsf@rho.meyering.net> <20110509104534.GA8147@verizon.net> Date: Mon, 09 May 2011 14:07:49 +0200 Message-ID: <874o54qdpm.fsf@rho.meyering.net> Lines: 54 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.0 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) tags 8636 + notabug thanks obb33@verizon.net wrote: > context: copy a linux system to a directory where, after chrooting to that > directory, i could safely torture and mangle the duplicate system. > > the command used was cp -xvdpR /* /newdirectory > > where / contains mounted other(not on the drive / is on) filesystems. these > are nfs mounts(direct and via ssh), mounted hard drives, and mounted loop > drives. > > the guilty party is apparently the wildcard > > the command as given above copies everything and descends all directories on > all mounted file systems under / no matter what they are. > > the command: cp -xvdp //* /newdirectory Thanks for explaining. With -x, cp considers each specified source directory when applying this rule: `-x' `--one-file-system' Skip subdirectories that are on different file systems from the one that the copy started on. However, mount point directories _are_ copied. So this might have been what you intended, assuming that /newdirectory is not on the same file system as "/": cp -xvdp / /newdirectory Even if it is on the same file system, it should work, but you should get a diagnostic about cp refusing to copy /newdirectory into itself. > descends into the top level of the otherfs dir and copies the files > therein, but does not descend into other directories. > > so the wildcard essentially negates -x and this was not anticipated > behavior. checking the docs i did not find any mention of this. > > if this is WAD, then it should be documented, however, i don't think that > someone using the -x wants a wildcard to undo that spec especially in a dir > with several mounts on subdirectories. I think it even works as _documented_ (in the "info" documentation) ;-) Yes, the five-word description in --help (and hence in "man cp") is too succinct, but at the end of that man page, you should see a note explaining that "info cp" will give you the real documentation. Would you like to suggest wording that would make it clearer? From unknown Tue Jun 17 01:42:54 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: obb33@verizon.net Subject: bug#8636: closed (Re: bug#8636: cp -x flag does not work) Message-ID: References: <871uvk6397.fsf@rho.meyering.net> <20110507165131.GA4102@verizon.net> X-Gnu-PR-Message: they-closed 8636 X-Gnu-PR-Package: coreutils Reply-To: 8636@debbugs.gnu.org Date: Tue, 13 Sep 2011 12:27:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1315916822-5973-1" This is a multi-part message in MIME format... ------------=_1315916822-5973-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #8636: cp -x flag does not work which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 8636@debbugs.gnu.org. --=20 8636: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8636 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1315916822-5973-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 8636-done) by debbugs.gnu.org; 13 Sep 2011 12:27:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3S4p-0001Y8-Lw for submit@debbugs.gnu.org; Tue, 13 Sep 2011 08:26:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3S4n-0001Y1-Js for 8636-done@debbugs.gnu.org; Tue, 13 Sep 2011 08:26:58 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8DCMUgc017560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <8636-done@debbugs.gnu.org>; Tue, 13 Sep 2011 08:22:30 -0400 Received: from mx.meyering.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8DCMT4k002371 for <8636-done@debbugs.gnu.org>; Tue, 13 Sep 2011 08:22:30 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id F32536004E for <8636-done@debbugs.gnu.org>; Tue, 13 Sep 2011 14:22:28 +0200 (CEST) From: Jim Meyering To: 8636-done@debbugs.gnu.org Subject: Re: bug#8636: cp -x flag does not work In-Reply-To: <874o54qdpm.fsf@rho.meyering.net> (Jim Meyering's message of "Mon, 09 May 2011 14:07:49 +0200") References: <20110507165131.GA4102@verizon.net> <87iptldron.fsf@rho.meyering.net> <20110509104534.GA8147@verizon.net> <874o54qdpm.fsf@rho.meyering.net> Date: Tue, 13 Sep 2011 14:22:28 +0200 Message-ID: <871uvk6397.fsf@rho.meyering.net> Lines: 9 MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.5 (----------) X-Debbugs-Envelope-To: 8636-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.5 (----------) tags 8636 + notabug thanks Jim Meyering wrote: > tags 8636 + notabug > thanks ... Marking this as done and (again) notabug. ------------=_1315916822-5973-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 May 2011 20:15:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QInu8-0005Nt-6U for submit@debbugs.gnu.org; Sat, 07 May 2011 16:15:08 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QImgB-0003iy-CI for submit@debbugs.gnu.org; Sat, 07 May 2011 14:56:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QImg5-00008b-Jw for submit@debbugs.gnu.org; Sat, 07 May 2011 14:56:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RFC_ABUSE_POST, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:37808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QImg5-00008X-IL for submit@debbugs.gnu.org; Sat, 07 May 2011 14:56:33 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QImg4-0001at-JG for bug-coreutils@gnu.org; Sat, 07 May 2011 14:56:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QImg3-00008H-Gh for bug-coreutils@gnu.org; Sat, 07 May 2011 14:56:32 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]:42422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QImg3-00007t-Dc for bug-coreutils@gnu.org; Sat, 07 May 2011 14:56:31 -0400 Received: from prism2.prism ([unknown] [108.25.20.12]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LKU004UI75NTHU6@vms173003.mailsrvcs.net> for bug-coreutils@gnu.org; Sat, 07 May 2011 12:56:12 -0500 (CDT) Received: from prism.prism (prism [10.0.0.11]) by prism2.prism (8.14.3/8.14.2) with ESMTP id p47HuCcr010750 for ; Sat, 07 May 2011 13:56:12 -0400 Received: (from kutek@localhost) by prism.prism (8.11.6/8.11.1) id p47GpYh05331 for bug-coreutils@gnu.org; Sat, 07 May 2011 12:51:34 -0400 X-Authentication-warning: prism.prism: kutek set sender to obb33@verizon.net using -f Date: Sat, 07 May 2011 12:51:31 -0400 From: obb33@verizon.net To: bug-coreutils@gnu.org Subject: cp -x flag does not work Message-id: <20110507165131.GA4102@verizon.net> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.4.2.1i X-detected-operating-system: by eggs.gnu.org: Solaris 10 (1203?) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 07 May 2011 16:15:06 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) coreutils 8.12, i don't know if this problem existed in previous versions. copying the root directory ( / ) of a running linux system using cp -xdvpR cp followed a directory that was mounted via NFS under / . the copy was stopped before any other directories on other filesystems were copied so i can't speak about how cp would handle those mounts. fractoid ------------=_1315916822-5973-1-- From unknown Tue Jun 17 01:42:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8636: closed (Re: bug#8636: cp -x flag does not work) Resent-From: peek@kutek.info Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 15 Sep 2011 16:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8636 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Jim Meyering Cc: 8636@debbugs.gnu.org Received: via spool by 8636-submit@debbugs.gnu.org id=B8636.131610293532246 (code B ref 8636); Thu, 15 Sep 2011 16:09:01 +0000 Received: (at 8636) by debbugs.gnu.org; 15 Sep 2011 16:08:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4EUf-0008O2-Vc for submit@debbugs.gnu.org; Thu, 15 Sep 2011 12:08:55 -0400 Received: from vms173019pub.verizon.net ([206.46.173.19]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4CRm-0006gq-9u for 8636@debbugs.gnu.org; Thu, 15 Sep 2011 09:57:47 -0400 Received: from prism2.prism ([unknown] [108.25.25.92]) by vms173019.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LRK006UOH7T44W1@vms173019.mailsrvcs.net> for 8636@debbugs.gnu.org; Thu, 15 Sep 2011 08:52:42 -0500 (CDT) Received: from prism.prism (prism [10.0.0.11]) by prism2.prism (8.14.5/8.14.2) with ESMTP id p8FDqfCa029187; Thu, 15 Sep 2011 09:52:41 -0400 Received: (from kutek@localhost) by prism.prism (8.11.6/8.11.1) id p8FCWip00213; Thu, 15 Sep 2011 08:32:44 -0400 X-Authentication-warning: prism.prism: kutek set sender to peek@kutek.info using -f Date: Thu, 15 Sep 2011 08:32:42 -0400 From: peek@kutek.info Message-id: <20110915123241.GA28419@verizon.net> References: <871uvk6397.fsf@rho.meyering.net> <20110507165131.GA4102@verizon.net> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline In-reply-to: User-Agent: Mutt/1.4.2.1i X-Spam-Score: -2.6 (--) X-Mailman-Approved-At: Thu, 15 Sep 2011 12:08:52 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Jim, I would ask you again to reconsider your view on this issue because it is irrational. you are claiming functionality that you do not provide (stay on one file system during a potentially recursive copy ) while allowing recursion into other file systems if they are mounted beneath the directory you are copying. why you think that this constitutes staying on one filesystem eludes me. find does this correctly ( -xdev or -mount switches) and coreutil's cp and mv can and should too. thanks for all the great work on coreutils and other of your work. if i had programming skills, i would fix this myself and provide a patch, but i don't. best regards, fractoid On Tue, Sep 13, 2011 at 12:27:02PM +0000, GNU bug Tracking System wrote: > Your bug report > > #8636: cp -x flag does not work > > which was filed against the coreutils package, has been closed. > > The explanation is attached below, along with your original report. > If you require more details, please reply to 8636@debbugs.gnu.org. > > -- > 8636: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8636 > GNU Bug Tracking System > Contact help-debbugs@gnu.org with problems > Date: Tue, 13 Sep 2011 14:22:28 +0200 > From: Jim Meyering > Subject: Re: bug#8636: cp -x flag does not work > To: 8636-done@debbugs.gnu.org > > tags 8636 + notabug > thanks > > Jim Meyering wrote: > > tags 8636 + notabug > > thanks > ... > > Marking this as done and (again) notabug. > > Date: Sat, 07 May 2011 12:51:31 -0400 > From: obb33@verizon.net > Subject: cp -x flag does not work > To: bug-coreutils@gnu.org > > coreutils 8.12, i don't know if this problem existed in previous versions. > > > copying the root directory ( / ) of a running linux system using cp -xdvpR > cp followed a directory that was mounted via NFS under / . the copy was > stopped before any other directories on other filesystems were copied so i > can't speak about how cp would handle those mounts. > > > > fractoid > > From unknown Tue Jun 17 01:42:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8636: closed (Re: bug#8636: cp -x flag does not work) Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 15 Sep 2011 16:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8636 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: peek@kutek.info Cc: 8636@debbugs.gnu.org, Jim Meyering Received: via spool by 8636-submit@debbugs.gnu.org id=B8636.13161035673852 (code B ref 8636); Thu, 15 Sep 2011 16:20:02 +0000 Received: (at 8636) by debbugs.gnu.org; 15 Sep 2011 16:19:27 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4Ees-000103-QM for submit@debbugs.gnu.org; Thu, 15 Sep 2011 12:19:27 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4Eeq-0000zv-3D for 8636@debbugs.gnu.org; Thu, 15 Sep 2011 12:19:25 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkkCAGEjck5tTcBk/2dsb2JhbAAMNpkWkQwBAQUyAUYQCw0LCSUPAkYTAQUCAQG+MoZ0BJkCi3A Received: from unknown (HELO [192.168.1.79]) ([109.77.192.100]) by mail3.vodafone.ie with ESMTP; 15 Sep 2011 17:14:43 +0100 Message-ID: <4E722472.108@draigBrady.com> Date: Thu, 15 Sep 2011 17:14:42 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 References: <871uvk6397.fsf@rho.meyering.net> <20110507165131.GA4102@verizon.net> <20110915123241.GA28419@verizon.net> In-Reply-To: <20110915123241.GA28419@verizon.net> X-Enigmail-Version: 1.3.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 09/15/2011 01:32 PM, peek@kutek.info wrote: > Hi Jim, > > I would ask you again to reconsider your view on this issue because it is > irrational. Reading back over the thread, I think it's a usage error. Note that cp does not process the wildcard, so that when you do: cp -x /* what cp is really getting from the shell is: cp -x /dir1 /dir2 ... cp is right to treat each of those independently. cheers, Pádraig. From unknown Tue Jun 17 01:42:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8636: closed (Re: bug#8636: cp -x flag does not work) Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 15 Sep 2011 16:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8636 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: peek@kutek.info Cc: 8636@debbugs.gnu.org Received: via spool by 8636-submit@debbugs.gnu.org id=B8636.13161038134216 (code B ref 8636); Thu, 15 Sep 2011 16:24:02 +0000 Received: (at 8636) by debbugs.gnu.org; 15 Sep 2011 16:23:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4Eiq-00015w-7N for submit@debbugs.gnu.org; Thu, 15 Sep 2011 12:23:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4Ein-00015o-Lf for 8636@debbugs.gnu.org; Thu, 15 Sep 2011 12:23:31 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8FGIoVh010296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Sep 2011 12:18:50 -0400 Received: from mx.meyering.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8FGInZF019925; Thu, 15 Sep 2011 12:18:49 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id C24DF60033; Thu, 15 Sep 2011 18:18:48 +0200 (CEST) From: Jim Meyering In-Reply-To: <20110915123241.GA28419@verizon.net> (peek@kutek.info's message of "Thu, 15 Sep 2011 08:32:42 -0400") References: <871uvk6397.fsf@rho.meyering.net> <20110507165131.GA4102@verizon.net> <20110915123241.GA28419@verizon.net> Date: Thu, 15 Sep 2011 18:18:48 +0200 Message-ID: <87obyln5hz.fsf@rho.meyering.net> Lines: 38 MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -10.5 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.5 (----------) peek@kutek.info wrote: > I would ask you again to reconsider your view on this issue because it is > irrational. > > you are claiming functionality that you do not provide (stay on one file > system during a potentially recursive copy ) while allowing recursion into > other file systems if they are mounted beneath the directory you are > copying. > > why you think that this constitutes staying on one filesystem eludes me. > > find does this correctly ( -xdev or -mount switches) and coreutil's cp and > mv can and should too. > > thanks for all the great work on coreutils and other of your work. if i had > programming skills, i would fix this myself and provide a patch, but i > don't. You used this command: cp -xvdpR /* /newdirectory That tells cp explicitly to copy every top-level directory under /. i.e., for each directory one level under /, cp copies it to newdirectory, but without traversing into a directory residing on a device different than the command-line-specified directory. That is how cp -x is documented to work. To get the behavior you want, run this command: cp -xvdpR / /newdirectory (note there's no "*" here, as you surmised in http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8636#11 your use of the "*" wildcard is what caused problems) I hope you see that there is nothing to reconsider and that cp -x can do precisely what you want. From unknown Tue Jun 17 01:42:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8636: cp -x flag does not work Resent-From: Bob Proulx Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 15 Sep 2011 16:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8636 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: peek@kutek.info Cc: 8636@debbugs.gnu.org Received: via spool by 8636-submit@debbugs.gnu.org id=B8636.13161046898550 (code B ref 8636); Thu, 15 Sep 2011 16:39:02 +0000 Received: (at 8636) by debbugs.gnu.org; 15 Sep 2011 16:38:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4Ewy-0002Dr-GG for submit@debbugs.gnu.org; Thu, 15 Sep 2011 12:38:08 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R4Ewv-0002Di-9g for 8636@debbugs.gnu.org; Thu, 15 Sep 2011 12:38:07 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 48707211D2; Thu, 15 Sep 2011 10:33:25 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id ED6402DC7E; Thu, 15 Sep 2011 10:33:24 -0600 (MDT) Date: Thu, 15 Sep 2011 10:33:24 -0600 From: Bob Proulx Message-ID: <20110915163324.GA9738@hysteria.proulx.com> References: <871uvk6397.fsf@rho.meyering.net> <20110507165131.GA4102@verizon.net> <20110915123241.GA28419@verizon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110915123241.GA28419@verizon.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.5 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) peek@kutek.info wrote: > you are claiming functionality that you do not provide (stay on one file > system during a potentially recursive copy ) while allowing recursion into > other file systems if they are mounted beneath the directory you are > copying. > > why you think that this constitutes staying on one filesystem eludes me. Let me help with this. You said the command you were using was: >> copying the root directory ( / ) of a running linux system using cp -xdvpR >> cp followed a directory that was mounted via NFS under / . This failure was not reproducible. More information was requested. In that follow-up you said the actual command you used was: >> the command used was cp -xvdpR /* /newdirectory >> the guilty party is apparently the wildcard >> the command as given above copies everything and descends all directories on >> all mounted file systems under / no matter what they are. That is correct. And that is the reason cp is doing the right thing and this is not a bug in cp. You have specifically requested that the mount point be copied. You may be misunderstanding how how wildcards work. The shell expands wildcards before invoking the command. You can see this using the echo command. $ echo somecommand /* The 'somecommand' does not see the '*' at all. The shell sees the '*' and expands it to match files. The names of the files replace the string on the command line. The modified list of arguments is passed to the command when it is invoked. The command does not know that a wildcard was involved. When you call cp -xvdpR /* /newdirectory The cp command sees something like (using ... to indicate more files): cp -xvdpR /bin /boot /dev /etc ... /mnt ... /newdirectory Since cp was asked to recursively copy /mnt it will copy /mnt and that is regardless of the -x option. The documentation for -x is: Skip subdirectories that are on different file systems from the one that the copy started on. The cp command was told to copy /mnt and relating to this documentation that is where the copy starts. If there is a mount point below that directory then the -x will instruct cp to skip it. But since /mnt was explicitly stated in the cp command it is not below anything and will not be skipped. If you were to remove the wildcard and specify only the root directory then the -x would skip any mount points below it. cp -xvdpR / /newdirectory There cp would be given only the / directory and the /mnt mount point below it would be skipped. > find does this correctly ( -xdev or -mount switches) and coreutil's cp and > mv can and should too. No it does not. Try 'find' on your mount point. I will use the "-maxdepth 2" to limit the amount of runtime only. But if run find using the same "/*" you used with cp then find will have the same behavior. find /* -xdev -maxdepth 2 -print Hope this helps. Bob