From: James Youngman <[email protected]> Signed-off-by: James Youngman <[email protected]> --- ChangeLog | 10 ++++++++++ NEWS | 6 ++++++ find/parser.c | 24 +++++++++++++++++++++--- 3 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index f17fc21..b354bb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-12-21 James Youngman <[email protected]> + + Fix Savannah bug #25144: Misleading message for find -user unknown. + * find/parser.c (parse_user): If there is no known group for the + specified user (and it does not appear to be a uid), issue a + fatal error message instead of returning false, because the error + message that results from a return of false is "invalid argument", + which is misleading in this case. Similarly for a missing or an + empty argument. + 2008-12-01 James Youngman <[email protected]> * po/fr.po: Updated French translation. diff --git a/NEWS b/NEWS index 4523f98..e5cb010 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,12 @@ GNU findutils NEWS - User visible changes. -*- outline -*- (allout) * Major changes in release 4.5.4-CVS, YYYY-MM-DD +** Bug Fixes + +#25144: Misleading error message when argument to find -user is an +unknown user or is missing. + + * Major changes in release 4.5.3, 2008-12-07 ** Bug Fixes diff --git a/find/parser.c b/find/parser.c index 102eb7d..852c63c 100644 --- a/find/parser.c +++ b/find/parser.c @@ -2447,11 +2447,29 @@ parse_user (const struct parser_table* entry, char **argv, int *arg_ptr) } else { - int uid_len = strspn (username, "0123456789"); + const size_t uid_len = strspn (username, "0123456789"); if (uid_len && (username[uid_len]==0)) - uid = safe_atoi (username); + { + uid = safe_atoi (username); + } else - return false; + { + /* This is a fatal error (if we just return false, the caller + * will say "invalid argument `username' to -user", which is + * not as helpful). */ + if (username[0]) + { + error (1, 0, _("%s is not the name of a known user."), + quotearg_n_style (0, options.err_quoting_style, + username)); + } + else + { + error (1, 0, _("The argument to -user should not be empty.")); + } + /*NOTREACHED*/ + return false; + } } our_pred = insert_primary (entry); our_pred->args.uid = uid; -- 1.5.6.5 _______________________________________________ Findutils-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/findutils-patches
