From keramida@freebsd.org  Thu Jan 22 05:18:29 2009
Return-Path: <keramida@freebsd.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DBEBF1065674
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Jan 2009 05:18:29 +0000 (UTC)
	(envelope-from keramida@freebsd.org)
Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36])
	by mx1.freebsd.org (Postfix) with ESMTP id 64D5C8FC16
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Jan 2009 05:18:28 +0000 (UTC)
	(envelope-from keramida@freebsd.org)
Received: from kobe.laptop (adsl189-242.kln.forthnet.gr [79.103.2.242])
	(authenticated bits=128)
	by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id n0M5ICeK028162
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Jan 2009 07:18:18 +0200
Received: from kobe.laptop (kobe.laptop [127.0.0.1])
	by kobe.laptop (8.14.3/8.14.3) with ESMTP id n0M5IBUH059898
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Jan 2009 07:18:11 +0200 (EET)
	(envelope-from keramida@freebsd.org)
Received: (from keramida@localhost)
	by kobe.laptop (8.14.3/8.14.3/Submit) id n0M5IBcn059897;
	Thu, 22 Jan 2009 07:18:11 +0200 (EET)
	(envelope-from keramida@freebsd.org)
Message-Id: <87tz7rdilo.fsf@kobe.laptop>
Date: Thu, 22 Jan 2009 07:18:11 +0200
From: Giorgos Keramidas <keramida@freebsd.org>
Reply-To: Giorgos Keramidas <keramida@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] a chown/chgrp -x option to avoid crossing mount points
X-Send-Pr-Version: 3.113
X-GNATS-Notify: keramida

>Number:         130855
>Category:       bin
>Synopsis:       [PATCH] add a chown(8)/chgrp(8) -x option to avoid crossing mount points
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gavin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 22 05:20:01 UTC 2009
>Closed-Date:    Thu Mar 25 13:17:02 UTC 2010
>Last-Modified:  Thu Mar 25 13:20:10 UTC 2010
>Originator:     Giorgos Keramidas
>Release:        FreeBSD 8.0-CURRENT i386
>Organization:
<organization of PR author (multiple lines)>
>Environment:

System: FreeBSD kobe 8.0-CURRENT FreeBSD 8.0-CURRENT #0: \
Wed Jan 14 02:12:50 EET 2009 build@kobe:/usr/obj/usr/src/sys/KOBE i386

>Description:

Some time ago, I hacked a -x option into my local chown/chgrp
version, to avoid crossing file system mount points.  This is
really a trivial patch, but if it is useful to anyone else we
can commit it to the src-tree too.

>How-To-Repeat:
>Fix:

--- chown-xdev.patch begins here ---

Add a new -x option to chown and chgrp, to inhibit file system
mount point traversal.  The -x option is documented, like -v, as
a non-standard option in the COMPATIBILITY manpage sections.

diff -r e8506b2ac7ae -r bc9edfda4335 usr.sbin/chown/chown.c
--- a/usr.sbin/chown/chown.c	Wed Jan 21 21:31:33 2009 +0200
+++ b/usr.sbin/chown/chown.c	Thu Jan 22 07:08:29 2009 +0200
@@ -73,14 +73,14 @@
 {
 	FTS *ftsp;
 	FTSENT *p;
-	int Hflag, Lflag, Rflag, fflag, hflag, vflag;
+	int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
 	int ch, fts_options, rval;
 	char *cp;
 
 	ischown = (strcmp(basename(argv[0]), "chown") == 0);
 
-	Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
-	while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
+	Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
+	while ((ch = getopt(argc, argv, "HLPRfhvx")) != -1)
 		switch (ch) {
 		case 'H':
 			Hflag = 1;
@@ -105,6 +105,9 @@
 		case 'v':
 			vflag++;
 			break;
+		case 'x':
+			xflag = 1;
+			break;
 		case '?':
 		default:
 			usage();
@@ -126,8 +129,11 @@
 			fts_options &= ~FTS_PHYSICAL;
 			fts_options |= FTS_LOGICAL;
 		}
-	} else
+	} else {
 		fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
+	}
+	if (xflag)
+		fts_options |= FTS_XDEV;
 
 	uid = (uid_t)-1;
 	gid = (gid_t)-1;
@@ -297,11 +303,11 @@
 
 	if (ischown)
 		(void)fprintf(stderr, "%s\n%s\n",
-		    "usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group]"
+		    "usage: chown [-fhvx] [-R [-H | -L | -P]] owner[:group]"
 		    " file ...",
-		    "       chown [-fhv] [-R [-H | -L | -P]] :group file ...");
+		    "       chown [-fhvx] [-R [-H | -L | -P]] :group file ...");
 	else
 		(void)fprintf(stderr, "%s\n",
-		    "usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ...");
+		    "usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
 	exit(1);
 }
diff -r e8506b2ac7ae -r bc9edfda4335 usr.sbin/chown/chgrp.1
--- a/usr.sbin/chown/chgrp.1	Wed Jan 21 21:31:33 2009 +0200
+++ b/usr.sbin/chown/chgrp.1	Thu Jan 22 07:08:29 2009 +0200
@@ -31,7 +31,7 @@
 .\"     @(#)chgrp.1	8.3 (Berkeley) 3/31/94
 .\" $FreeBSD$
 .\"
-.Dd April 25, 2003
+.Dd January 22, 2009
 .Dt CHGRP 1
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .Nd change group
 .Sh SYNOPSIS
 .Nm
-.Op Fl fhv
+.Op Fl fhvx
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
@@ -89,6 +89,8 @@
 flag is specified more than once,
 .Nm
 will print the filename, followed by the old and new numeric group ID.
+.It Fl x
+File system mount points are not traversed.
 .El
 .Pp
 The
@@ -125,7 +127,9 @@
 .Pp
 The
 .Fl v
-option is non-standard and its use in scripts is not recommended.
+and
+.Fl x
+options are non-standard and their use in scripts is not recommended.
 .Sh SEE ALSO
 .Xr chown 2 ,
 .Xr fts 3 ,
diff -r e8506b2ac7ae -r bc9edfda4335 usr.sbin/chown/chown.8
--- a/usr.sbin/chown/chown.8	Wed Jan 21 21:31:33 2009 +0200
+++ b/usr.sbin/chown/chown.8	Thu Jan 22 07:08:29 2009 +0200
@@ -28,7 +28,7 @@
 .\"     @(#)chown.8	8.3 (Berkeley) 3/31/94
 .\" $FreeBSD$
 .\"
-.Dd April 25, 2003
+.Dd January 22, 2009
 .Dt CHOWN 8
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Nd change file owner and group
 .Sh SYNOPSIS
 .Nm
-.Op Fl fhv
+.Op Fl fhvx
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
@@ -44,7 +44,7 @@
 .Ar owner Ns Op : Ns Ar group
 .Ar
 .Nm
-.Op Fl fhv
+.Op Fl fhvx
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
@@ -97,6 +97,8 @@
 flag is specified more than once,
 .Nm
 will print the filename, followed by the old and new numeric user/group ID.
+.It Fl x
+File system mount points are not traversed.
 .El
 .Pp
 The
@@ -146,7 +148,9 @@
 .Pp
 The
 .Fl v
-option is non-standard and its use in scripts is not recommended.
+and
+.Fl x
+options are non-standard and their use in scripts is not recommended.
 .Sh SEE ALSO
 .Xr chgrp 1 ,
 .Xr find 1 ,
--- chown-xdev.patch ends here ---
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gavin 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Sun Feb 14 20:48:44 UTC 2010 
Responsible-Changed-Why:  
Take 

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

From: Giorgos Keramidas <keramida@freebsd.org>
To: gavin@freebsd.org
Cc: bug-followup@freebsd.org
Subject: Re: bin/130855: [PATCH] add a chown(8)/chgrp(8) -x option to avoid crossing mount points
Date: Mon, 15 Feb 2010 02:21:09 +0200

 On Sun, 14 Feb 2010 21:11:45 GMT, gavin@FreeBSD.org wrote:
 > Synopsis: [PATCH] add a chown(8)/chgrp(8) -x option to avoid crossing mount points
 >
 > Responsible-Changed-From-To: freebsd-bugs->gavin
 > Responsible-Changed-By: gavin
 > Responsible-Changed-When: Sun Feb 14 20:48:44 UTC 2010
 > Responsible-Changed-Why:
 > Take
 >
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=130855
 
 I've already done this locally.  If you can re-use parts of the patch
 here is the updated version of the changes, merged with the latest /head
 branch:
 
 %%%
 diff -r 4b723a943c7d -r 6a5fe21cf2da usr.sbin/chown/chgrp.1
 --- a/usr.sbin/chown/chgrp.1	Sun Feb 14 20:10:41 2010 +0000
 +++ b/usr.sbin/chown/chgrp.1	Mon Feb 15 02:04:20 2010 +0200
 @@ -31,7 +31,7 @@
  .\"     @(#)chgrp.1	8.3 (Berkeley) 3/31/94
  .\" $FreeBSD$
  .\"
 -.Dd April 25, 2003
 +.Dd January 22, 2009
  .Dt CHGRP 1
  .Os
  .Sh NAME
 @@ -39,7 +39,7 @@
  .Nd change group
  .Sh SYNOPSIS
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -89,6 +89,8 @@ If the
  flag is specified more than once,
  .Nm
  will print the filename, followed by the old and new numeric group ID.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  The
 @@ -125,7 +127,9 @@ In previous versions of this system, sym
  .Pp
  The
  .Fl v
 -option is non-standard and its use in scripts is not recommended.
 +and
 +.Fl x
 +options are non-standard and their use in scripts is not recommended.
  .Sh SEE ALSO
  .Xr chown 2 ,
  .Xr fts 3 ,
 diff -r 4b723a943c7d -r 6a5fe21cf2da usr.sbin/chown/chown.8
 --- a/usr.sbin/chown/chown.8	Sun Feb 14 20:10:41 2010 +0000
 +++ b/usr.sbin/chown/chown.8	Mon Feb 15 02:04:20 2010 +0200
 @@ -28,7 +28,7 @@
  .\"     @(#)chown.8	8.3 (Berkeley) 3/31/94
  .\" $FreeBSD$
  .\"
 -.Dd April 25, 2003
 +.Dd January 22, 2009
  .Dt CHOWN 8
  .Os
  .Sh NAME
 @@ -36,7 +36,7 @@
  .Nd change file owner and group
  .Sh SYNOPSIS
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -44,7 +44,7 @@
  .Ar owner Ns Op : Ns Ar group
  .Ar
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -97,6 +97,8 @@ If the
  flag is specified more than once,
  .Nm
  will print the filename, followed by the old and new numeric user/group ID.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  The
 @@ -146,7 +148,9 @@ owners.
  .Pp
  The
  .Fl v
 -option is non-standard and its use in scripts is not recommended.
 +and
 +.Fl x
 +options are non-standard and their use in scripts is not recommended.
  .Sh SEE ALSO
  .Xr chgrp 1 ,
  .Xr find 1 ,
 diff -r 4b723a943c7d -r 6a5fe21cf2da usr.sbin/chown/chown.c
 --- a/usr.sbin/chown/chown.c	Sun Feb 14 20:10:41 2010 +0000
 +++ b/usr.sbin/chown/chown.c	Mon Feb 15 02:04:20 2010 +0200
 @@ -73,14 +73,14 @@ main(int argc, char **argv)
  {
  	FTS *ftsp;
  	FTSENT *p;
 -	int Hflag, Lflag, Rflag, fflag, hflag, vflag;
 +	int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
  	int ch, fts_options, rval;
  	char *cp;
  
  	ischown = (strcmp(basename(argv[0]), "chown") == 0);
  
 -	Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
 -	while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
 +	Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
 +	while ((ch = getopt(argc, argv, "HLPRfhvx")) != -1)
  		switch (ch) {
  		case 'H':
  			Hflag = 1;
 @@ -105,6 +105,9 @@ main(int argc, char **argv)
  		case 'v':
  			vflag++;
  			break;
 +		case 'x':
 +			xflag = 1;
 +			break;
  		case '?':
  		default:
  			usage();
 @@ -128,6 +131,8 @@ main(int argc, char **argv)
  		}
  	} else
  		fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
 +	if (xflag)
 +		fts_options |= FTS_XDEV;
  
  	uid = (uid_t)-1;
  	gid = (gid_t)-1;
 @@ -301,11 +306,11 @@ usage(void)
  
  	if (ischown)
  		(void)fprintf(stderr, "%s\n%s\n",
 -		    "usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group]"
 +		    "usage: chown [-fhvx] [-R [-H | -L | -P]] owner[:group]"
  		    " file ...",
 -		    "       chown [-fhv] [-R [-H | -L | -P]] :group file ...");
 +		    "       chown [-fhvx] [-R [-H | -L | -P]] :group file ...");
  	else
  		(void)fprintf(stderr, "%s\n",
 -		    "usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ...");
 +		    "usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
  	exit(1);
  }
 %%%
State-Changed-From-To: open->patched 
State-Changed-By: gavin 
State-Changed-When: Sun Feb 21 10:14:24 UTC 2010 
State-Changed-Why:  
Fixed in head (r204165), MFC in a month 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/130855: commit references a PR
Date: Sun, 21 Feb 2010 10:14:21 +0000 (UTC)

 Author: gavin
 Date: Sun Feb 21 10:14:06 2010
 New Revision: 204165
 URL: http://svn.freebsd.org/changeset/base/204165
 
 Log:
   Add a "-x" option to chown(8)/chgrp(1) similar to the same option in
   du(1), cp(1) etc, to prevent the crossing of mountpoints whilst using the
   commands recursively.
   
   PR:		bin/130855
   Submitted by:	keramida
   MFC after:	1 month
 
 Modified:
   head/usr.sbin/chown/chgrp.1
   head/usr.sbin/chown/chown.8
   head/usr.sbin/chown/chown.c
 
 Modified: head/usr.sbin/chown/chgrp.1
 ==============================================================================
 --- head/usr.sbin/chown/chgrp.1	Sun Feb 21 09:25:53 2010	(r204164)
 +++ head/usr.sbin/chown/chgrp.1	Sun Feb 21 10:14:06 2010	(r204165)
 @@ -31,7 +31,7 @@
  .\"     @(#)chgrp.1	8.3 (Berkeley) 3/31/94
  .\" $FreeBSD$
  .\"
 -.Dd April 25, 2003
 +.Dd February 21, 2010
  .Dt CHGRP 1
  .Os
  .Sh NAME
 @@ -39,7 +39,7 @@
  .Nd change group
  .Sh SYNOPSIS
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -89,6 +89,8 @@ If the
  flag is specified more than once,
  .Nm
  will print the filename, followed by the old and new numeric group ID.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  The
 @@ -125,7 +127,9 @@ In previous versions of this system, sym
  .Pp
  The
  .Fl v
 -option is non-standard and its use in scripts is not recommended.
 +and
 +.Fl x
 +options are non-standard and their use in scripts is not recommended.
  .Sh SEE ALSO
  .Xr chown 2 ,
  .Xr fts 3 ,
 
 Modified: head/usr.sbin/chown/chown.8
 ==============================================================================
 --- head/usr.sbin/chown/chown.8	Sun Feb 21 09:25:53 2010	(r204164)
 +++ head/usr.sbin/chown/chown.8	Sun Feb 21 10:14:06 2010	(r204165)
 @@ -28,7 +28,7 @@
  .\"     @(#)chown.8	8.3 (Berkeley) 3/31/94
  .\" $FreeBSD$
  .\"
 -.Dd April 25, 2003
 +.Dd February 21, 2010
  .Dt CHOWN 8
  .Os
  .Sh NAME
 @@ -36,7 +36,7 @@
  .Nd change file owner and group
  .Sh SYNOPSIS
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -44,7 +44,7 @@
  .Ar owner Ns Op : Ns Ar group
  .Ar
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -97,6 +97,8 @@ If the
  flag is specified more than once,
  .Nm
  will print the filename, followed by the old and new numeric user/group ID.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  The
 @@ -146,7 +148,9 @@ owners.
  .Pp
  The
  .Fl v
 -option is non-standard and its use in scripts is not recommended.
 +and
 +.Fl x
 +options are non-standard and their use in scripts is not recommended.
  .Sh SEE ALSO
  .Xr chgrp 1 ,
  .Xr find 1 ,
 
 Modified: head/usr.sbin/chown/chown.c
 ==============================================================================
 --- head/usr.sbin/chown/chown.c	Sun Feb 21 09:25:53 2010	(r204164)
 +++ head/usr.sbin/chown/chown.c	Sun Feb 21 10:14:06 2010	(r204165)
 @@ -73,14 +73,14 @@ main(int argc, char **argv)
  {
  	FTS *ftsp;
  	FTSENT *p;
 -	int Hflag, Lflag, Rflag, fflag, hflag, vflag;
 +	int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
  	int ch, fts_options, rval;
  	char *cp;
  
  	ischown = (strcmp(basename(argv[0]), "chown") == 0);
  
 -	Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
 -	while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
 +	Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
 +	while ((ch = getopt(argc, argv, "HLPRfhvx")) != -1)
  		switch (ch) {
  		case 'H':
  			Hflag = 1;
 @@ -105,6 +105,9 @@ main(int argc, char **argv)
  		case 'v':
  			vflag++;
  			break;
 +		case 'x':
 +			xflag = 1;
 +			break;
  		case '?':
  		default:
  			usage();
 @@ -128,6 +131,8 @@ main(int argc, char **argv)
  		}
  	} else
  		fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
 +	if (xflag)
 +		fts_options |= FTS_XDEV;
  
  	uid = (uid_t)-1;
  	gid = (gid_t)-1;
 @@ -301,11 +306,11 @@ usage(void)
  
  	if (ischown)
  		(void)fprintf(stderr, "%s\n%s\n",
 -		    "usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group]"
 +		    "usage: chown [-fhvx] [-R [-H | -L | -P]] owner[:group]"
  		    " file ...",
 -		    "       chown [-fhv] [-R [-H | -L | -P]] :group file ...");
 +		    "       chown [-fhvx] [-R [-H | -L | -P]] :group file ...");
  	else
  		(void)fprintf(stderr, "%s\n",
 -		    "usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ...");
 +		    "usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
  	exit(1);
  }
 _______________________________________________
 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"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/130855: commit references a PR
Date: Thu, 25 Mar 2010 12:56:29 +0000 (UTC)

 Author: gavin
 Date: Thu Mar 25 12:56:20 2010
 New Revision: 205638
 URL: http://svn.freebsd.org/changeset/base/205638
 
 Log:
   Merge r204165 from head:
   
     Add a "-x" option to chown(8)/chgrp(1) similar to the same option in
     du(1), cp(1) etc, to prevent the crossing of mountpoints whilst using the
     commands recursively.
   
   PR:		bin/130855
   Submitted by:	keramida
 
 Modified:
   stable/8/usr.sbin/chown/chgrp.1
   stable/8/usr.sbin/chown/chown.8
   stable/8/usr.sbin/chown/chown.c
 Directory Properties:
   stable/8/usr.sbin/chown/   (props changed)
 
 Modified: stable/8/usr.sbin/chown/chgrp.1
 ==============================================================================
 --- stable/8/usr.sbin/chown/chgrp.1	Thu Mar 25 10:29:00 2010	(r205637)
 +++ stable/8/usr.sbin/chown/chgrp.1	Thu Mar 25 12:56:20 2010	(r205638)
 @@ -31,7 +31,7 @@
  .\"     @(#)chgrp.1	8.3 (Berkeley) 3/31/94
  .\" $FreeBSD$
  .\"
 -.Dd April 25, 2003
 +.Dd February 21, 2010
  .Dt CHGRP 1
  .Os
  .Sh NAME
 @@ -39,7 +39,7 @@
  .Nd change group
  .Sh SYNOPSIS
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -89,6 +89,8 @@ If the
  flag is specified more than once,
  .Nm
  will print the filename, followed by the old and new numeric group ID.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  The
 @@ -125,7 +127,9 @@ In previous versions of this system, sym
  .Pp
  The
  .Fl v
 -option is non-standard and its use in scripts is not recommended.
 +and
 +.Fl x
 +options are non-standard and their use in scripts is not recommended.
  .Sh SEE ALSO
  .Xr chown 2 ,
  .Xr fts 3 ,
 
 Modified: stable/8/usr.sbin/chown/chown.8
 ==============================================================================
 --- stable/8/usr.sbin/chown/chown.8	Thu Mar 25 10:29:00 2010	(r205637)
 +++ stable/8/usr.sbin/chown/chown.8	Thu Mar 25 12:56:20 2010	(r205638)
 @@ -28,7 +28,7 @@
  .\"     @(#)chown.8	8.3 (Berkeley) 3/31/94
  .\" $FreeBSD$
  .\"
 -.Dd April 25, 2003
 +.Dd February 21, 2010
  .Dt CHOWN 8
  .Os
  .Sh NAME
 @@ -36,7 +36,7 @@
  .Nd change file owner and group
  .Sh SYNOPSIS
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -44,7 +44,7 @@
  .Ar owner Ns Op : Ns Ar group
  .Ar
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -97,6 +97,8 @@ If the
  flag is specified more than once,
  .Nm
  will print the filename, followed by the old and new numeric user/group ID.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  The
 @@ -146,7 +148,9 @@ owners.
  .Pp
  The
  .Fl v
 -option is non-standard and its use in scripts is not recommended.
 +and
 +.Fl x
 +options are non-standard and their use in scripts is not recommended.
  .Sh SEE ALSO
  .Xr chgrp 1 ,
  .Xr find 1 ,
 
 Modified: stable/8/usr.sbin/chown/chown.c
 ==============================================================================
 --- stable/8/usr.sbin/chown/chown.c	Thu Mar 25 10:29:00 2010	(r205637)
 +++ stable/8/usr.sbin/chown/chown.c	Thu Mar 25 12:56:20 2010	(r205638)
 @@ -73,14 +73,14 @@ main(int argc, char **argv)
  {
  	FTS *ftsp;
  	FTSENT *p;
 -	int Hflag, Lflag, Rflag, fflag, hflag, vflag;
 +	int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
  	int ch, fts_options, rval;
  	char *cp;
  
  	ischown = (strcmp(basename(argv[0]), "chown") == 0);
  
 -	Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
 -	while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
 +	Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
 +	while ((ch = getopt(argc, argv, "HLPRfhvx")) != -1)
  		switch (ch) {
  		case 'H':
  			Hflag = 1;
 @@ -105,6 +105,9 @@ main(int argc, char **argv)
  		case 'v':
  			vflag++;
  			break;
 +		case 'x':
 +			xflag = 1;
 +			break;
  		case '?':
  		default:
  			usage();
 @@ -128,6 +131,8 @@ main(int argc, char **argv)
  		}
  	} else
  		fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
 +	if (xflag)
 +		fts_options |= FTS_XDEV;
  
  	uid = (uid_t)-1;
  	gid = (gid_t)-1;
 @@ -301,11 +306,11 @@ usage(void)
  
  	if (ischown)
  		(void)fprintf(stderr, "%s\n%s\n",
 -		    "usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group]"
 +		    "usage: chown [-fhvx] [-R [-H | -L | -P]] owner[:group]"
  		    " file ...",
 -		    "       chown [-fhv] [-R [-H | -L | -P]] :group file ...");
 +		    "       chown [-fhvx] [-R [-H | -L | -P]] :group file ...");
  	else
  		(void)fprintf(stderr, "%s\n",
 -		    "usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ...");
 +		    "usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
  	exit(1);
  }
 _______________________________________________
 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: Thu Mar 25 13:16:33 UTC 2010 
State-Changed-Why:  
Fixed in head, merged to stable/8 and stable/7.  Thanks for your submission! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/130855: commit references a PR
Date: Thu, 25 Mar 2010 13:16:11 +0000 (UTC)

 Author: gavin
 Date: Thu Mar 25 13:15:55 2010
 New Revision: 205639
 URL: http://svn.freebsd.org/changeset/base/205639
 
 Log:
   Merge r204165 from head:
   
     Add a "-x" option to chown(8)/chgrp(1) similar to the same option in
     du(1), cp(1) etc, to prevent the crossing of mountpoints whilst using the
     commands recursively.
   
   PR:		bin/130855
   Submitted by:	keramida
 
 Modified:
   stable/7/usr.sbin/chown/chgrp.1
   stable/7/usr.sbin/chown/chown.8
   stable/7/usr.sbin/chown/chown.c
 Directory Properties:
   stable/7/usr.sbin/chown/   (props changed)
 
 Modified: stable/7/usr.sbin/chown/chgrp.1
 ==============================================================================
 --- stable/7/usr.sbin/chown/chgrp.1	Thu Mar 25 12:56:20 2010	(r205638)
 +++ stable/7/usr.sbin/chown/chgrp.1	Thu Mar 25 13:15:55 2010	(r205639)
 @@ -31,7 +31,7 @@
  .\"     @(#)chgrp.1	8.3 (Berkeley) 3/31/94
  .\" $FreeBSD$
  .\"
 -.Dd April 25, 2003
 +.Dd February 21, 2010
  .Dt CHGRP 1
  .Os
  .Sh NAME
 @@ -39,7 +39,7 @@
  .Nd change group
  .Sh SYNOPSIS
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -89,6 +89,8 @@ If the
  flag is specified more than once,
  .Nm
  will print the filename, followed by the old and new numeric group ID.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  The
 @@ -125,7 +127,9 @@ In previous versions of this system, sym
  .Pp
  The
  .Fl v
 -option is non-standard and its use in scripts is not recommended.
 +and
 +.Fl x
 +options are non-standard and their use in scripts is not recommended.
  .Sh SEE ALSO
  .Xr chown 2 ,
  .Xr fts 3 ,
 
 Modified: stable/7/usr.sbin/chown/chown.8
 ==============================================================================
 --- stable/7/usr.sbin/chown/chown.8	Thu Mar 25 12:56:20 2010	(r205638)
 +++ stable/7/usr.sbin/chown/chown.8	Thu Mar 25 13:15:55 2010	(r205639)
 @@ -28,7 +28,7 @@
  .\"     @(#)chown.8	8.3 (Berkeley) 3/31/94
  .\" $FreeBSD$
  .\"
 -.Dd April 25, 2003
 +.Dd February 21, 2010
  .Dt CHOWN 8
  .Os
  .Sh NAME
 @@ -36,7 +36,7 @@
  .Nd change file owner and group
  .Sh SYNOPSIS
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -44,7 +44,7 @@
  .Ar owner Ns Op : Ns Ar group
  .Ar
  .Nm
 -.Op Fl fhv
 +.Op Fl fhvx
  .Oo
  .Fl R
  .Op Fl H | Fl L | Fl P
 @@ -97,6 +97,8 @@ If the
  flag is specified more than once,
  .Nm
  will print the filename, followed by the old and new numeric user/group ID.
 +.It Fl x
 +File system mount points are not traversed.
  .El
  .Pp
  The
 @@ -146,7 +148,9 @@ owners.
  .Pp
  The
  .Fl v
 -option is non-standard and its use in scripts is not recommended.
 +and
 +.Fl x
 +options are non-standard and their use in scripts is not recommended.
  .Sh SEE ALSO
  .Xr chgrp 1 ,
  .Xr find 1 ,
 
 Modified: stable/7/usr.sbin/chown/chown.c
 ==============================================================================
 --- stable/7/usr.sbin/chown/chown.c	Thu Mar 25 12:56:20 2010	(r205638)
 +++ stable/7/usr.sbin/chown/chown.c	Thu Mar 25 13:15:55 2010	(r205639)
 @@ -73,14 +73,14 @@ main(int argc, char **argv)
  {
  	FTS *ftsp;
  	FTSENT *p;
 -	int Hflag, Lflag, Rflag, fflag, hflag, vflag;
 +	int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
  	int ch, fts_options, rval;
  	char *cp;
  
  	ischown = (strcmp(basename(argv[0]), "chown") == 0);
  
 -	Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
 -	while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
 +	Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
 +	while ((ch = getopt(argc, argv, "HLPRfhvx")) != -1)
  		switch (ch) {
  		case 'H':
  			Hflag = 1;
 @@ -105,6 +105,9 @@ main(int argc, char **argv)
  		case 'v':
  			vflag++;
  			break;
 +		case 'x':
 +			xflag = 1;
 +			break;
  		case '?':
  		default:
  			usage();
 @@ -128,6 +131,8 @@ main(int argc, char **argv)
  		}
  	} else
  		fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
 +	if (xflag)
 +		fts_options |= FTS_XDEV;
  
  	uid = (uid_t)-1;
  	gid = (gid_t)-1;
 @@ -301,11 +306,11 @@ usage(void)
  
  	if (ischown)
  		(void)fprintf(stderr, "%s\n%s\n",
 -		    "usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group]"
 +		    "usage: chown [-fhvx] [-R [-H | -L | -P]] owner[:group]"
  		    " file ...",
 -		    "       chown [-fhv] [-R [-H | -L | -P]] :group file ...");
 +		    "       chown [-fhvx] [-R [-H | -L | -P]] :group file ...");
  	else
  		(void)fprintf(stderr, "%s\n",
 -		    "usage: chgrp [-fhv] [-R [-H | -L | -P]] group file ...");
 +		    "usage: chgrp [-fhvx] [-R [-H | -L | -P]] group file ...");
  	exit(1);
  }
 _______________________________________________
 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:
