From nobody@FreeBSD.org  Wed Oct 26 20:12:44 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id EB82F16A420
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Oct 2005 20:12:44 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 398D543D53
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Oct 2005 20:12:44 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j9QKChx7067302
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Oct 2005 20:12:43 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j9QKChD9067301;
	Wed, 26 Oct 2005 20:12:43 GMT
	(envelope-from nobody)
Message-Id: <200510262012.j9QKChD9067301@www.freebsd.org>
Date: Wed, 26 Oct 2005 20:12:43 GMT
From: Mike Silbersack <silby@silby.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: cp could really use Linux's -x option (stay on this file system)
X-Send-Pr-Version: www-2.3

>Number:         88056
>Category:       bin
>Synopsis:       [patch] [request] cp(1) could really use Linux's -x option (stay on this file system)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gavin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 26 20:20:20 GMT 2005
>Closed-Date:    Sun Mar 14 16:04:30 UTC 2010
>Last-Modified:  Sun Mar 14 16:10:04 UTC 2010
>Originator:     Mike Silbersack
>Release:        6
>Organization:
The FreeBSD Project
>Environment:
>Description:
I was cloning a machine when I noticed that we don't have -x, meaning
that I had to be very careful when copying the / filesystem.  If we
had -x, that would be much simpler to do.
>How-To-Repeat:
              
>Fix:
              
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: linimon 
State-Changed-When: Wed Oct 26 22:10:33 GMT 2005 
State-Changed-Why:  
Mark suspended awaiting patches from someone with an interest. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88056 

From: Graham J Lee <leeg@teaching.physics.ox.ac.uk>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/88056
Date: Wed, 31 May 2006 22:27:50 +0100

 This is a multi-part message in MIME format.
 --------------030803070701060008010503
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 I've only tried this on Darwin/BSD but it appears to work...adds a '-x' 
 flag which sets the FTS_XDEV option.
 
 Cheers,
 Graham.
 -- 
 Graham Lee
 UNIX Systems Manager,
 Oxford Physics Practical Course
 http://users.ox.ac.uk/~wadh1342
 
 --------------030803070701060008010503
 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
  name="cp.c.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="cp.c.patch"
 
 --- cp.c.orig	2006-05-31 22:15:03.000000000 +0100
 +++ cp.c	2006-05-31 22:17:55.000000000 +0100
 @@ -83,7 +83,7 @@
  
  PATH_T to = { to.p_path, emptystring, "" };
  
 -int fflag, iflag, nflag, pflag, vflag;
 +int fflag, iflag, nflag, pflag, vflag, xflag;
  static int Rflag, rflag;
  volatile sig_atomic_t info;
  
 @@ -101,8 +101,8 @@
  	int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash;
  	char *target;
  
 -	Hflag = Lflag = Pflag = 0;
 -	while ((ch = getopt(argc, argv, "HLPRfinprv")) != -1)
 +	Hflag = Lflag = Pflag = xflag = 0;
 +	while ((ch = getopt(argc, argv, "HLPRfinprvx")) != -1)
  		switch (ch) {
  		case 'H':
  			Hflag = 1;
 @@ -140,6 +140,9 @@
  		case 'v':
  			vflag = 1;
  			break;
 +		case 'x':
 +		        xflag = 1;
 +			break;
  		default:
  			usage();
  			break;
 @@ -151,6 +154,9 @@
  		usage();
  
  	fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
 +	if (xflag) {
 +	        fts_options |= FTS_XDEV;
 +	}
  	if (rflag) {
  		if (Rflag)
  			errx(1,
 
 --------------030803070701060008010503
 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
  name="utils.c.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="utils.c.patch"
 
 --- utils.c.orig	2006-05-31 22:20:13.000000000 +0100
 +++ utils.c	2006-05-31 22:21:46.000000000 +0100
 @@ -411,8 +411,8 @@
  {
  
  	(void)fprintf(stderr, "%s\n%s\n",
 -"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] source_file target_file",
 -"       cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] source_file ... "
 +"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pvx] source_file target_file",
 +"       cp [-R [-H | -L | -P]] [-f | -i | -n] [-pvx] source_file ... "
  "target_directory");
  	exit(EX_USAGE);
  }
 
 --------------030803070701060008010503--
State-Changed-From-To: suspended->open 
State-Changed-By: linimon 
State-Changed-When: Sat Jun 3 19:05:06 UTC 2006 
State-Changed-Why:  
leeg@teaching.physics.ox.ac.uk has provided a patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88056 
Responsible-Changed-From-To: freebsd-bugs->gavin 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Sat Jan 16 21:19:28 UTC 2010 
Responsible-Changed-Why:  
Mine 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88056 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/88056: commit references a PR
Date: Sun, 17 Jan 2010 09:37:43 +0000 (UTC)

 Author: gavin
 Date: Sun Jan 17 09:37:31 2010
 New Revision: 202461
 URL: http://svn.freebsd.org/changeset/base/202461
 
 Log:
   Implement an "-x" option to cp(1), for compatibility with Linux and
   feature parity with du(1) and similar:  When set, cp(1) will not traverse
   mount points.
   
   Initial patch by:       Graham J Lee   leeg teaching.physics.ox.ac.uk
   
   PR:		bin/88056
   Initial patch by: Graham J Lee   leeg teaching.physics.ox.ac.uk
   Approved by:	ed (mentor)
   MFC after:	1 month
 
 Modified:
   head/bin/cp/cp.1
   head/bin/cp/cp.c
   head/bin/cp/utils.c
 
 Modified: head/bin/cp/cp.1
 ==============================================================================
 --- head/bin/cp/cp.1	Sun Jan 17 08:41:07 2010	(r202460)
 +++ head/bin/cp/cp.1	Sun Jan 17 09:37:31 2010	(r202461)
 @@ -32,7 +32,7 @@
  .\"	@(#)cp.1	8.3 (Berkeley) 4/18/94
  .\" $FreeBSD$
  .\"
 -.Dd October 27, 2006
 +.Dd January 17, 2010
  .Dt CP 1
  .Os
  .Sh NAME
 @@ -45,7 +45,7 @@
  .Op Fl H | Fl L | Fl P
  .Oc
  .Op Fl f | i | n
 -.Op Fl alpv
 +.Op Fl alpvx
  .Ar source_file target_file
  .Nm
  .Oo
 @@ -53,7 +53,7 @@
  .Op Fl H | Fl L | Fl P
  .Oc
  .Op Fl f | i | n
 -.Op Fl alpv
 +.Op Fl alpvx
  .Ar source_file ... target_directory
  .Sh DESCRIPTION
  In the first synopsis form, the
 @@ -183,6 +183,8 @@ permissions.
  Cause
  .Nm
  to be verbose, showing files as they are copied.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  For each destination file that already exists, its contents are
 
 Modified: head/bin/cp/cp.c
 ==============================================================================
 --- head/bin/cp/cp.c	Sun Jan 17 08:41:07 2010	(r202460)
 +++ head/bin/cp/cp.c	Sun Jan 17 09:37:31 2010	(r202461)
 @@ -101,8 +101,9 @@ main(int argc, char *argv[])
  	int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash;
  	char *target;
  
 +	fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
  	Hflag = Lflag = Pflag = 0;
 -	while ((ch = getopt(argc, argv, "HLPRafilnprv")) != -1)
 +	while ((ch = getopt(argc, argv, "HLPRafilnprvx")) != -1)
  		switch (ch) {
  		case 'H':
  			Hflag = 1;
 @@ -150,6 +151,9 @@ main(int argc, char *argv[])
  		case 'v':
  			vflag = 1;
  			break;
 +		case 'x':
 +			fts_options |= FTS_XDEV;
 +			break;
  		default:
  			usage();
  			break;
 @@ -160,7 +164,6 @@ main(int argc, char *argv[])
  	if (argc < 2)
  		usage();
  
 -	fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
  	if (Rflag && rflag)
  		errx(1, "the -R and -r options may not be specified together");
  	if (rflag)
 
 Modified: head/bin/cp/utils.c
 ==============================================================================
 --- head/bin/cp/utils.c	Sun Jan 17 08:41:07 2010	(r202460)
 +++ head/bin/cp/utils.c	Sun Jan 17 09:37:31 2010	(r202461)
 @@ -518,8 +518,8 @@ usage(void)
  {
  
  	(void)fprintf(stderr, "%s\n%s\n",
 -"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file",
 -"       cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... "
 +"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file",
 +"       cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... "
  "target_directory");
  	exit(EX_USAGE);
  }
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: gavin 
State-Changed-When: Sun Jan 17 09:41:12 UTC 2010 
State-Changed-Why:  
Patched, will merge in 1 month 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88056 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/88056: commit references a PR
Date: Tue, 16 Feb 2010 22:20:13 +0000 (UTC)

 Author: gavin
 Date: Tue Feb 16 22:19:55 2010
 New Revision: 203975
 URL: http://svn.freebsd.org/changeset/base/203975
 
 Log:
   Merge r202461 from head:
   
     Implement an "-x" option to cp(1), for compatibility with Linux and
     feature parity with du(1) and similar:  When set, cp(1) will not traverse
     mount points.
   
   PR:		bin/88056
   Initial patch by: Graham J Lee   leeg teaching.physics.ox.ac.uk
 
 Modified:
   stable/8/bin/cp/cp.1
   stable/8/bin/cp/cp.c
   stable/8/bin/cp/utils.c
 Directory Properties:
   stable/8/bin/cp/   (props changed)
 
 Modified: stable/8/bin/cp/cp.1
 ==============================================================================
 --- stable/8/bin/cp/cp.1	Tue Feb 16 21:59:17 2010	(r203974)
 +++ stable/8/bin/cp/cp.1	Tue Feb 16 22:19:55 2010	(r203975)
 @@ -32,7 +32,7 @@
  .\"	@(#)cp.1	8.3 (Berkeley) 4/18/94
  .\" $FreeBSD$
  .\"
 -.Dd October 27, 2006
 +.Dd January 17, 2010
  .Dt CP 1
  .Os
  .Sh NAME
 @@ -45,7 +45,7 @@
  .Op Fl H | Fl L | Fl P
  .Oc
  .Op Fl f | i | n
 -.Op Fl alpv
 +.Op Fl alpvx
  .Ar source_file target_file
  .Nm
  .Oo
 @@ -53,7 +53,7 @@
  .Op Fl H | Fl L | Fl P
  .Oc
  .Op Fl f | i | n
 -.Op Fl alpv
 +.Op Fl alpvx
  .Ar source_file ... target_directory
  .Sh DESCRIPTION
  In the first synopsis form, the
 @@ -183,6 +183,8 @@ permissions.
  Cause
  .Nm
  to be verbose, showing files as they are copied.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  For each destination file that already exists, its contents are
 
 Modified: stable/8/bin/cp/cp.c
 ==============================================================================
 --- stable/8/bin/cp/cp.c	Tue Feb 16 21:59:17 2010	(r203974)
 +++ stable/8/bin/cp/cp.c	Tue Feb 16 22:19:55 2010	(r203975)
 @@ -101,8 +101,9 @@ main(int argc, char *argv[])
  	int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash;
  	char *target;
  
 +	fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
  	Hflag = Lflag = Pflag = 0;
 -	while ((ch = getopt(argc, argv, "HLPRafilnprv")) != -1)
 +	while ((ch = getopt(argc, argv, "HLPRafilnprvx")) != -1)
  		switch (ch) {
  		case 'H':
  			Hflag = 1;
 @@ -150,6 +151,9 @@ main(int argc, char *argv[])
  		case 'v':
  			vflag = 1;
  			break;
 +		case 'x':
 +			fts_options |= FTS_XDEV;
 +			break;
  		default:
  			usage();
  			break;
 @@ -160,7 +164,6 @@ main(int argc, char *argv[])
  	if (argc < 2)
  		usage();
  
 -	fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
  	if (Rflag && rflag)
  		errx(1, "the -R and -r options may not be specified together");
  	if (rflag)
 
 Modified: stable/8/bin/cp/utils.c
 ==============================================================================
 --- stable/8/bin/cp/utils.c	Tue Feb 16 21:59:17 2010	(r203974)
 +++ stable/8/bin/cp/utils.c	Tue Feb 16 22:19:55 2010	(r203975)
 @@ -518,8 +518,8 @@ usage(void)
  {
  
  	(void)fprintf(stderr, "%s\n%s\n",
 -"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file",
 -"       cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... "
 +"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file",
 +"       cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... "
  "target_directory");
  	exit(EX_USAGE);
  }
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: gavin 
State-Changed-When: Sun Mar 14 16:03:52 UTC 2010 
State-Changed-Why:  
Committed to head, nad merged to stable/8 and stable/7.  Thanks for your bug 
report and patch! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=88056 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/88056: commit references a PR
Date: Sun, 14 Mar 2010 16:03:55 +0000 (UTC)

 Author: gavin
 Date: Sun Mar 14 16:03:36 2010
 New Revision: 205156
 URL: http://svn.freebsd.org/changeset/base/205156
 
 Log:
   Merge r202461 from head:
   
     Implement an "-x" option to cp(1), for compatibility with Linux and
     feature parity with du(1) and similar:  When set, cp(1) will not traverse
     mount points.
   
   PR:		bin/88056
   Initial patch by: Graham J Lee  <leeg teaching.physics.ox.ac.uk>
 
 Modified:
   stable/7/bin/cp/cp.1
   stable/7/bin/cp/cp.c
   stable/7/bin/cp/utils.c
 Directory Properties:
   stable/7/bin/cp/   (props changed)
 
 Modified: stable/7/bin/cp/cp.1
 ==============================================================================
 --- stable/7/bin/cp/cp.1	Sun Mar 14 15:49:04 2010	(r205155)
 +++ stable/7/bin/cp/cp.1	Sun Mar 14 16:03:36 2010	(r205156)
 @@ -32,7 +32,7 @@
  .\"	@(#)cp.1	8.3 (Berkeley) 4/18/94
  .\" $FreeBSD$
  .\"
 -.Dd October 27, 2006
 +.Dd January 17, 2010
  .Dt CP 1
  .Os
  .Sh NAME
 @@ -45,7 +45,7 @@
  .Op Fl H | Fl L | Fl P
  .Oc
  .Op Fl f | i | n
 -.Op Fl alpv
 +.Op Fl alpvx
  .Ar source_file target_file
  .Nm
  .Oo
 @@ -53,7 +53,7 @@
  .Op Fl H | Fl L | Fl P
  .Oc
  .Op Fl f | i | n
 -.Op Fl alpv
 +.Op Fl alpvx
  .Ar source_file ... target_directory
  .Sh DESCRIPTION
  In the first synopsis form, the
 @@ -183,6 +183,8 @@ permissions.
  Cause
  .Nm
  to be verbose, showing files as they are copied.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  For each destination file that already exists, its contents are
 
 Modified: stable/7/bin/cp/cp.c
 ==============================================================================
 --- stable/7/bin/cp/cp.c	Sun Mar 14 15:49:04 2010	(r205155)
 +++ stable/7/bin/cp/cp.c	Sun Mar 14 16:03:36 2010	(r205156)
 @@ -101,8 +101,9 @@ main(int argc, char *argv[])
  	int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash;
  	char *target;
  
 +	fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
  	Hflag = Lflag = Pflag = 0;
 -	while ((ch = getopt(argc, argv, "HLPRafilnprv")) != -1)
 +	while ((ch = getopt(argc, argv, "HLPRafilnprvx")) != -1)
  		switch (ch) {
  		case 'H':
  			Hflag = 1;
 @@ -150,6 +151,9 @@ main(int argc, char *argv[])
  		case 'v':
  			vflag = 1;
  			break;
 +		case 'x':
 +			fts_options |= FTS_XDEV;
 +			break;
  		default:
  			usage();
  			break;
 @@ -160,7 +164,6 @@ main(int argc, char *argv[])
  	if (argc < 2)
  		usage();
  
 -	fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
  	if (Rflag && rflag)
  		errx(1, "the -R and -r options may not be specified together");
  	if (rflag)
 
 Modified: stable/7/bin/cp/utils.c
 ==============================================================================
 --- stable/7/bin/cp/utils.c	Sun Mar 14 15:49:04 2010	(r205155)
 +++ stable/7/bin/cp/utils.c	Sun Mar 14 16:03:36 2010	(r205156)
 @@ -429,8 +429,8 @@ usage(void)
  {
  
  	(void)fprintf(stderr, "%s\n%s\n",
 -"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file",
 -"       cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... "
 +"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file target_file",
 +"       cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpvx] source_file ... "
  "target_directory");
  	exit(EX_USAGE);
  }
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
