Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/find Extend the numeric handling for uids with -user...



details:   https://anonhg.NetBSD.org/src/rev/6ae07d007bfb
branches:  trunk
changeset: 345878:6ae07d007bfb
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jun 12 20:50:10 2016 +0000

description:
Extend the numeric handling for uids with -user to gids with -group, and
document it. Leftover bit of PR 46158.

diffstat:

 usr.bin/find/find.1     |  14 +++++++-------
 usr.bin/find/function.c |  18 +++++++++++-------
 2 files changed, 18 insertions(+), 14 deletions(-)

diffs (88 lines):

diff -r beb1339586a9 -r 6ae07d007bfb usr.bin/find/find.1
--- a/usr.bin/find/find.1       Sun Jun 12 18:44:46 2016 +0000
+++ b/usr.bin/find/find.1       Sun Jun 12 20:50:10 2016 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: find.1,v 1.82 2016/06/12 03:21:35 pgoyette Exp $
+.\"    $NetBSD: find.1,v 1.83 2016/06/12 20:50:10 dholland Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -406,7 +406,7 @@
 .Ar gname
 is numeric and there is no such group name, then
 .Ar gname
-is treated as a group id.
+is treated as a group id (and considered a numeric argument).
 .Pp
 .It Ic -iname Ar pattern
 True if the last component of the pathname being examined matches
@@ -673,13 +673,13 @@
 whiteout
 .El
 .Pp
-.It Ic -user Ar uname
+.It Ic -user Ar username
 True if the file belongs to the user
-.Ar uname .
+.Ar username .
 If
-.Ar uname
-is numeric and there is no such user name, then
-.Ar uname
+.Ar username
+is numeric and there is no such user on the system, then
+.Ar username
 is treated as a user id (and considered a numeric argument).
 .Pp
 .It Ic -xdev
diff -r beb1339586a9 -r 6ae07d007bfb usr.bin/find/function.c
--- a/usr.bin/find/function.c   Sun Jun 12 18:44:46 2016 +0000
+++ b/usr.bin/find/function.c   Sun Jun 12 20:50:10 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: function.c,v 1.72 2013/05/04 06:29:32 uebayasi Exp $   */
+/*     $NetBSD: function.c,v 1.73 2016/06/12 20:50:10 dholland Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c   8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.72 2013/05/04 06:29:32 uebayasi Exp $");
+__RCSID("$NetBSD: function.c,v 1.73 2016/06/12 20:50:10 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -1060,7 +1060,7 @@
 f_group(PLAN *plan, FTSENT *entry)
 {
 
-       return (entry->fts_statp->st_gid == plan->g_data);
+       COMPARE(entry->fts_statp->st_gid, plan->g_data);
 }
 
 PLAN *
@@ -1074,15 +1074,19 @@
        (*argvp)++;
        ftsoptions &= ~FTS_NOSTAT;
 
+       new = palloc(N_GROUP, f_group);
        g = getgrnam(gname);
        if (g == NULL) {
-               gid = atoi(gname);
-               if (gid == 0 && gname[0] != '0')
+               if (atoi(gname) == 0 && gname[0] != '0' &&
+                   strcmp(gname, "+0") && strcmp(gname, "-0"))
                        errx(1, "-group: %s: no such group", gname);
-       } else
+               gid = find_parsenum(new, "-group", gname, NULL);
+
+       } else {
+               new->flags = F_EQUAL;
                gid = g->gr_gid;
+       }
 
-       new = palloc(N_GROUP, f_group);
        new->g_data = gid;
        return (new);
 }



Home | Main Index | Thread Index | Old Index