CVS commit: src/sbin/chown
Module Name:src Committed By: wiz Date: Tue Jul 4 06:53:12 UTC 2017 Modified Files: src/sbin/chown: chown.8 Log Message: Add EXIT STATUS section. Use Ex. Sort sections. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sbin/chown/chown.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chown.8 diff -u src/sbin/chown/chown.8:1.11 src/sbin/chown/chown.8:1.12 --- src/sbin/chown/chown.8:1.11 Mon Jul 3 21:33:41 2017 +++ src/sbin/chown/chown.8 Tue Jul 4 06:53:12 2017 @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)chown.8 8.3 (Berkeley) 3/31/94 -.\" $NetBSD: chown.8,v 1.11 2017/07/03 21:33:41 wiz Exp $ +.\" $NetBSD: chown.8,v 1.12 2017/07/04 06:53:12 wiz Exp $ .\" .Dd September 11, 2016 .Dt CHOWN 8 @@ -151,10 +151,8 @@ Unless invoked by the super-user, clears the set-user-id and set-group-id bits on a file to prevent accidental or mischievous creation of set-user-id and set-group-id programs. -.Pp -The -.Nm -utility exits 0 on success, and >0 if an error occurs. +.Sh EXIT STATUS +.Ex -std chown .Sh COMPATIBILITY Previous versions of the .Nm @@ -169,11 +167,6 @@ group names may contain the dot characte .Xr lchown 2 , .Xr fts 3 , .Xr symlink 7 -.Sh HISTORY -A -.Nm -utility appeared in -.At v1 . .Sh STANDARDS The .Nm @@ -184,3 +177,8 @@ The option and the use of ``#'' to force a numeric lookup are extensions to .St -p1003.2 . +.Sh HISTORY +A +.Nm +utility appeared in +.At v1 .
CVS commit: src/sbin/chown
Module Name:src Committed By: wiz Date: Tue Jul 4 06:52:20 UTC 2017 Modified Files: src/sbin/chown: chgrp.1 Log Message: Add EXIT STATUS section. Use Ex. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sbin/chown/chgrp.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chgrp.1 diff -u src/sbin/chown/chgrp.1:1.7 src/sbin/chown/chgrp.1:1.8 --- src/sbin/chown/chgrp.1:1.7 Mon Jul 3 21:33:41 2017 +++ src/sbin/chown/chgrp.1 Tue Jul 4 06:52:20 2017 @@ -29,7 +29,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)chgrp.1 8.3 (Berkeley) 3/31/94 -.\" $NetBSD: chgrp.1,v 1.7 2017/07/03 21:33:41 wiz Exp $ +.\" $NetBSD: chgrp.1,v 1.8 2017/07/04 06:52:20 wiz Exp $ .\" .Dd October 22, 2012 .Dt CHGRP 1 @@ -142,15 +142,13 @@ Unless invoked by the super-user, clears the set-user-id and set-group-id bits on a file to prevent accidental or mischievous creation of set-user-id or set-group-id programs. -.Pp -The -.Nm -utility exits 0 on success, and >0 if an error occurs. .Sh FILES .Bl -tag -width /etc/group -compact .It Pa /etc/group Group ID file .El +.Sh EXIT STATUS +.Ex -std chgrp .Sh SEE ALSO .Xr chown 2 , .Xr lchown 2 ,
CVS commit: src/sbin/chown
Module Name:src Committed By: sevan Date: Sun Sep 11 01:23:26 UTC 2016 Modified Files: src/sbin/chown: chown.8 Log Message: Document the version chown first appeared. Replace contractions highlighted by textproc/igor. Bump date. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/chown/chown.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chown.8 diff -u src/sbin/chown/chown.8:1.9 src/sbin/chown/chown.8:1.10 --- src/sbin/chown/chown.8:1.9 Tue Jul 12 10:56:01 2016 +++ src/sbin/chown/chown.8 Sun Sep 11 01:23:26 2016 @@ -26,9 +26,9 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)chown.8 8.3 (Berkeley) 3/31/94 -.\" $NetBSD: chown.8,v 1.9 2016/07/12 10:56:01 wiz Exp $ +.\" $NetBSD: chown.8,v 1.10 2016/09/11 01:23:26 sevan Exp $ .\" -.Dd July 12, 2016 +.Dd September 11, 2016 .Dt CHOWN 8 .Os .Sh NAME @@ -85,7 +85,7 @@ option is specified, no symbolic links a Change the user ID and/or the group ID for the file hierarchies rooted in the files instead of just the files themselves. .It Fl f -Don't report any failure to change file owner or group, nor modify +Do not report any failure to change file owner or group, nor modify the exit status to reflect such failures. .It Fl h If @@ -138,7 +138,7 @@ The .Ar group may be either a group name or a numeric group ID. Since it is valid to have a user or group name that is numeric (and -doesn't have the numeric ID that matches its name) the name lookup +does not have the numeric ID that matches its name) the name lookup is always done first. Preceding an ID with a ``#'' character will force it to be taken as a number. @@ -169,6 +169,11 @@ group names may contain the dot characte .Xr lchown 2 , .Xr fts 3 , .Xr symlink 7 +.Sh HISTORY +A +.Nm +utility appeared in +.At v1 . .Sh STANDARDS The .Nm
CVS commit: src/sbin/chown
Module Name:src Committed By: wiz Date: Tue Jul 12 10:56:01 UTC 2016 Modified Files: src/sbin/chown: chown.8 Log Message: Bump date for previous. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/chown/chown.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chown.8 diff -u src/sbin/chown/chown.8:1.8 src/sbin/chown/chown.8:1.9 --- src/sbin/chown/chown.8:1.8 Tue Jul 12 09:59:42 2016 +++ src/sbin/chown/chown.8 Tue Jul 12 10:56:01 2016 @@ -26,9 +26,9 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)chown.8 8.3 (Berkeley) 3/31/94 -.\" $NetBSD: chown.8,v 1.8 2016/07/12 09:59:42 zafer Exp $ +.\" $NetBSD: chown.8,v 1.9 2016/07/12 10:56:01 wiz Exp $ .\" -.Dd October 22, 2012 +.Dd July 12, 2016 .Dt CHOWN 8 .Os .Sh NAME
CVS commit: src/sbin/chown
Module Name:src Committed By: zafer Date: Tue Jul 12 09:59:42 UTC 2016 Modified Files: src/sbin/chown: chown.8 Log Message: improve description regarding symbolic links. ok @wiz. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sbin/chown/chown.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chown.8 diff -u src/sbin/chown/chown.8:1.7 src/sbin/chown/chown.8:1.8 --- src/sbin/chown/chown.8:1.7 Tue Dec 17 09:54:08 2013 +++ src/sbin/chown/chown.8 Tue Jul 12 09:59:42 2016 @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)chown.8 8.3 (Berkeley) 3/31/94 -.\" $NetBSD: chown.8,v 1.7 2013/12/17 09:54:08 apb Exp $ +.\" $NetBSD: chown.8,v 1.8 2016/07/12 09:59:42 zafer Exp $ .\" .Dd October 22, 2012 .Dt CHOWN 8 @@ -62,6 +62,9 @@ .Sh DESCRIPTION .Nm sets the user ID and/or the group ID of the specified files. +Symbolic links named by arguments are silently left unchanged unless +.Fl h +is used. .Pp The options are as follows: .Bl -tag -width Ds
CVS commit: src/sbin/chown
Module Name:src Committed By: wiz Date: Tue Oct 23 17:31:00 UTC 2012 Modified Files: src/sbin/chown: chown.8 Log Message: + ly To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/chown/chown.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chown.8 diff -u src/sbin/chown/chown.8:1.5 src/sbin/chown/chown.8:1.6 --- src/sbin/chown/chown.8:1.5 Mon Oct 22 18:02:26 2012 +++ src/sbin/chown/chown.8 Tue Oct 23 17:30:59 2012 @@ -26,7 +26,7 @@ .\ SUCH DAMAGE. .\ .\ from: @(#)chown.8 8.3 (Berkeley) 3/31/94 -.\ $NetBSD: chown.8,v 1.5 2012/10/22 18:02:26 christos Exp $ +.\ $NetBSD: chown.8,v 1.6 2012/10/23 17:30:59 wiz Exp $ .\ .Dd October 22, 2012 .Dt CHOWN 8 @@ -115,7 +115,7 @@ The .Ar owner and .Ar group -operands are both optional, however, one must be specified; alternative +operands are both optional, however, one must be specified; alternatively, both the owner and group may be specified using a reference .Ar rfile specified using the
CVS commit: src/sbin/chown
Module Name:src Committed By: christos Date: Tue Oct 23 17:55:46 UTC 2012 Modified Files: src/sbin/chown: chown.c Log Message: - use {g,s}etprogname() - fix usage To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/chown/chown.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chown.c diff -u src/sbin/chown/chown.c:1.6 src/sbin/chown/chown.c:1.7 --- src/sbin/chown/chown.c:1.6 Mon Oct 22 14:02:26 2012 +++ src/sbin/chown/chown.c Tue Oct 23 13:55:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: chown.c,v 1.6 2012/10/22 18:02:26 christos Exp $ */ +/* $NetBSD: chown.c,v 1.7 2012/10/23 17:55:46 christos Exp $ */ /* * Copyright (c) 1988, 1993, 1994, 2003 @@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = @(#)chown.c 8.8 (Berkeley) 4/4/94; #else -__RCSID($NetBSD: chown.c,v 1.6 2012/10/22 18:02:26 christos Exp $); +__RCSID($NetBSD: chown.c,v 1.7 2012/10/23 17:55:46 christos Exp $); #endif #endif /* not lint */ @@ -68,7 +68,7 @@ __dead static void usage(void); static uid_t uid; static gid_t gid; static int ischown; -static char *myname; +static const char *myname; struct option chown_longopts[] = { { reference, required_argument, 0, @@ -86,9 +86,11 @@ main(int argc, char **argv) char *cp, *reference; int (*change_owner)(const char *, uid_t, gid_t); + setprogname(*argv); + (void)setlocale(LC_ALL, ); - myname = (cp = strrchr(*argv, '/')) ? cp + 1 : *argv; + myname = getprogname(); ischown = (myname[2] == 'o'); reference = NULL; @@ -292,7 +294,9 @@ usage(void) { (void)fprintf(stderr, - usage: %s [-R [-H | -L | -P]] [-fhv] %s file ...\n, - myname, ischown ? [owner][:group] : group); + Usage: %s [-R [-H | -L | -P]] [-fhv] %s file ...\n + \t%s [-R [-H | -L | -P]] [-fhv] --reference=rfile file ...\n, + myname, ischown ? owner:group|owner|:group : group, + myname); exit(EXIT_FAILURE); }
CVS commit: src/sbin/chown
Module Name:src Committed By: enami Date: Wed Oct 24 01:12:52 UTC 2012 Modified Files: src/sbin/chown: chown.c Log Message: The id chgrp command is required to change is not uid but gid. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sbin/chown/chown.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chown.c diff -u src/sbin/chown/chown.c:1.7 src/sbin/chown/chown.c:1.8 --- src/sbin/chown/chown.c:1.7 Tue Oct 23 17:55:46 2012 +++ src/sbin/chown/chown.c Wed Oct 24 01:12:51 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: chown.c,v 1.7 2012/10/23 17:55:46 christos Exp $ */ +/* $NetBSD: chown.c,v 1.8 2012/10/24 01:12:51 enami Exp $ */ /* * Copyright (c) 1988, 1993, 1994, 2003 @@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = @(#)chown.c 8.8 (Berkeley) 4/4/94; #else -__RCSID($NetBSD: chown.c,v 1.7 2012/10/23 17:55:46 christos Exp $); +__RCSID($NetBSD: chown.c,v 1.8 2012/10/24 01:12:51 enami Exp $); #endif #endif /* not lint */ @@ -181,9 +181,9 @@ main(int argc, char **argv) if (stat(reference, st) == -1) err(EXIT_FAILURE, Cannot stat `%s', reference); - uid = st.st_uid; if (ischown) - gid = st.st_gid; + uid = st.st_uid; + gid = st.st_gid; } if ((ftsp = fts_open(argv, fts_options, NULL)) == NULL)
CVS commit: src/sbin/chown
Module Name:src Committed By: christos Date: Mon Oct 22 18:02:26 UTC 2012 Modified Files: src/sbin/chown: chgrp.1 chown.8 chown.c Log Message: support --reference=rfile To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/chown/chgrp.1 src/sbin/chown/chown.8 cvs rdiff -u -r1.5 -r1.6 src/sbin/chown/chown.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/chgrp.1 diff -u src/sbin/chown/chgrp.1:1.4 src/sbin/chown/chgrp.1:1.5 --- src/sbin/chown/chgrp.1:1.4 Thu Jan 13 17:28:36 2011 +++ src/sbin/chown/chgrp.1 Mon Oct 22 14:02:26 2012 @@ -29,9 +29,9 @@ .\ SUCH DAMAGE. .\ .\ from: @(#)chgrp.1 8.3 (Berkeley) 3/31/94 -.\ $NetBSD: chgrp.1,v 1.4 2011/01/13 22:28:36 haad Exp $ +.\ $NetBSD: chgrp.1,v 1.5 2012/10/22 18:02:26 christos Exp $ .\ -.Dd September 25, 2003 +.Dd October 22, 2012 .Dt CHGRP 1 .Os .Sh NAME @@ -45,7 +45,15 @@ .Oc .Op Fl fhv .Ar group -.Ar file ... +.Ar +.Nm +.Oo +.Fl R +.Op Fl H | Fl L | Fl P +.Oc +.Op Fl fhv +.Fl Fl reference=rfile +.Ar .Sh DESCRIPTION The .Nm @@ -53,7 +61,12 @@ utility sets the group ID of the file na .Ar file operand to the .Ar group -ID specified by the group operand. +ID specified by the group operand, +or to the group of the given +.Ar rfile , +specified by the +.Fl Fl reference +argument. .Pp Options: .Bl -tag -width Ds Index: src/sbin/chown/chown.8 diff -u src/sbin/chown/chown.8:1.4 src/sbin/chown/chown.8:1.5 --- src/sbin/chown/chown.8:1.4 Thu Jan 13 17:28:36 2011 +++ src/sbin/chown/chown.8 Mon Oct 22 14:02:26 2012 @@ -26,9 +26,9 @@ .\ SUCH DAMAGE. .\ .\ from: @(#)chown.8 8.3 (Berkeley) 3/31/94 -.\ $NetBSD: chown.8,v 1.4 2011/01/13 22:28:36 haad Exp $ +.\ $NetBSD: chown.8,v 1.5 2012/10/22 18:02:26 christos Exp $ .\ -.Dd December 9, 2005 +.Dd October 22, 2012 .Dt CHOWN 8 .Os .Sh NAME @@ -42,7 +42,7 @@ .Oc .Op Fl fhv .Ar owner Ns Op Ar :group -.Ar file ... +.Ar .Nm .Oo .Fl R @@ -50,7 +50,15 @@ .Oc .Op Fl fhv .Ar :group -.Ar file ... +.Ar +.Nm +.Oo +.Fl R +.Op Fl H | Fl L | Fl P +.Oc +.Op Fl fhv +.Fl Fl reference=rfile +.Ar .Sh DESCRIPTION .Nm sets the user ID and/or the group ID of the specified files. @@ -107,7 +115,12 @@ The .Ar owner and .Ar group -operands are both optional, however, one must be specified. +operands are both optional, however, one must be specified; alternative +both the owner and group may be specified using a reference +.Ar rfile +specified using the +.Fl Fl reference +argument. If the .Ar group operand is specified, it must be preceded by a colon (``:'') character. Index: src/sbin/chown/chown.c diff -u src/sbin/chown/chown.c:1.5 src/sbin/chown/chown.c:1.6 --- src/sbin/chown/chown.c:1.5 Mon Aug 29 10:34:59 2011 +++ src/sbin/chown/chown.c Mon Oct 22 14:02:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: chown.c,v 1.5 2011/08/29 14:34:59 joerg Exp $ */ +/* $NetBSD: chown.c,v 1.6 2012/10/22 18:02:26 christos Exp $ */ /* * Copyright (c) 1988, 1993, 1994, 2003 @@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = @(#)chown.c 8.8 (Berkeley) 4/4/94; #else -__RCSID($NetBSD: chown.c,v 1.5 2011/08/29 14:34:59 joerg Exp $); +__RCSID($NetBSD: chown.c,v 1.6 2012/10/22 18:02:26 christos Exp $); #endif #endif /* not lint */ @@ -58,6 +58,7 @@ __RCSID($NetBSD: chown.c,v 1.5 2011/08/ #include stdlib.h #include string.h #include unistd.h +#include getopt.h static void a_gid(const char *); static void a_uid(const char *); @@ -69,23 +70,35 @@ static gid_t gid; static int ischown; static char *myname; +struct option chown_longopts[] = { + { reference, required_argument, 0, + 1 }, + { NULL, 0, 0, + 0 }, +}; + int main(int argc, char **argv) { FTS *ftsp; FTSENT *p; int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval, vflag; - char *cp; + char *cp, *reference; int (*change_owner)(const char *, uid_t, gid_t); (void)setlocale(LC_ALL, ); myname = (cp = strrchr(*argv, '/')) ? cp + 1 : *argv; ischown = (myname[2] == 'o'); + reference = NULL; Hflag = Lflag = Rflag = fflag = hflag = vflag = 0; - while ((ch = getopt(argc, argv, HLPRfhv)) != -1) + while ((ch = getopt_long(argc, argv, HLPRfhv, + chown_longopts, NULL)) != -1) switch (ch) { + case 1: + reference = optarg; + break; case 'H': Hflag = 1; Lflag = 0; @@ -123,7 +136,7 @@ main(int argc, char **argv) argv += optind; argc -= optind; - if (argc 2) + if (argc == 0 || (argc == 1 reference == NULL)) usage(); fts_options = FTS_PHYSICAL; @@ -143,24 +156,35 @@ main(int argc, char **argv) uid = (uid_t)-1; gid = (gid_t)-1; - if (ischown) { - if ((cp = strchr(*argv, ':')) != NULL) { - *cp++ = '\0'; - a_gid(cp); - } -#ifdef SUPPORT_DOT - else if ((cp = strrchr(*argv, '.')) != NULL) { - if (uid_from_user(*argv, uid) == -1) { + if (reference == NULL) { + if (ischown) { + if ((cp = strchr(*argv, ':'))
CVS commit: src/sbin/chown
Module Name:src Committed By: haad Date: Thu Jan 13 23:44:11 UTC 2011 Modified Files: src/sbin/chown: Makefile Log Message: Use SYMLINKS, I'm not sure why I ahve commited old version of my patch, but it should be ok now. Thanks to tron@ for pointing at this issue. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/chown/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/chown/Makefile diff -u src/sbin/chown/Makefile:1.5 src/sbin/chown/Makefile:1.6 --- src/sbin/chown/Makefile:1.5 Thu Jan 13 22:28:36 2011 +++ src/sbin/chown/Makefile Thu Jan 13 23:44:11 2011 @@ -1,12 +1,12 @@ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 -# $NetBSD: Makefile,v 1.5 2011/01/13 22:28:36 haad Exp $ +# $NetBSD: Makefile,v 1.6 2011/01/13 23:44:11 haad Exp $ PROG= chown CPPFLAGS+=-DSUPPORT_DOT MAN= chgrp.1 chown.8 -LINKS= ${BINDIR}/chown /bin/chgrp +SYMLINKS+= ${BINDIR}/chown /bin/chgrp -LINKS+= ${BINDIR}/chown /usr/bin/chgrp -LINKS+= ${BINDIR}/chown /usr/sbin/chown +SYMLINKS+= ${BINDIR}/chown /usr/bin/chgrp +SYMLINKS+= ${BINDIR}/chown /usr/sbin/chown .include bsd.prog.mk