[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: chown/chgrp: inconsistent error message
From: |
Jim Meyering |
Subject: |
Re: chown/chgrp: inconsistent error message |
Date: |
Sat, 16 Jun 2007 15:11:18 +0200 |
Egmont Koblinger <address@hidden> wrote:
> $ chown asdf x; chgrp asdf x
> chown: `asdf': invalid user
> chgrp: invalid group `asdf'
>
> These two very similar utilities use different wording for the same kind of
> error message (nonexistent user or group).
Thanks for pointing that out.
I've adjusted things so they're consistent:
chgrp: invalid group: `g'
chown: invalid user: `g'
Here's the patch:
Make chgrp and chown diagnostics consistent.
* src/chown.c (main): Emit the diagnostic before the file name,
not after it, to be consistent with chgrp's diagnostic.
* src/chgrp.c (parse_group): Emit a ":" between the diagnostic
and the file name.
Reported by Egmont Koblinger.
* THANKS: Add Egmont Koblinger.
Signed-off-by: Jim Meyering <address@hidden>
---
ChangeLog | 10 ++++++++++
THANKS | 1 +
src/chgrp.c | 4 ++--
src/chown.c | 6 +++---
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f456c6a..e68c7ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-06-16 Jim Meyering <address@hidden>
+
+ Make chgrp and chown diagnostics consistent.
+ * src/chown.c (main): Emit the diagnostic before the file name,
+ not after it, to be consistent with chgrp's diagnostic.
+ * src/chgrp.c (parse_group): Emit a ":" between the diagnostic
+ and the file name.
+ Reported by Egmont Koblinger.
+ * THANKS: Add Egmont Koblinger.
+
2007-06-15 Paul Eggert <address@hidden>
Correct cp's handling of destination symlinks in some cases.
diff --git a/THANKS b/THANKS
index c86dab7..cd5efae 100644
--- a/THANKS
+++ b/THANKS
@@ -141,6 +141,7 @@ Duncan Roe address@hidden
Ed Avis address@hidden
Edward Welbourne address@hidden
Edzer Pebesma address@hidden
+Egmont Koblinger address@hidden
Eirik Fuller address@hidden
Eivind address@hidden
Eli Zaretskii address@hidden
diff --git a/src/chgrp.c b/src/chgrp.c
index 1778a8d..0560aa4 100644
--- a/src/chgrp.c
+++ b/src/chgrp.c
@@ -1,5 +1,5 @@
/* chgrp -- change group ownership of files
- Copyright (C) 89, 90, 91, 1995-2006 Free Software Foundation, Inc.
+ Copyright (C) 89, 90, 91, 1995-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -92,7 +92,7 @@ parse_group (const char *name)
unsigned long int tmp;
if (! (xstrtoul (name, NULL, 10, &tmp, "") == LONGINT_OK
&& tmp <= GID_T_MAX))
- error (EXIT_FAILURE, 0, _("invalid group %s"), quote (name));
+ error (EXIT_FAILURE, 0, _("invalid group: %s"), quote (name));
gid = tmp;
}
endgrent (); /* Save a file descriptor. */
diff --git a/src/chown.c b/src/chown.c
index 29b75a2..8ad7618 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -1,5 +1,5 @@
/* chown -- change user and group ownership of files
- Copyright (C) 89, 90, 91, 1995-2006 Free Software Foundation, Inc.
+ Copyright (C) 89, 90, 91, 1995-2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -239,7 +239,7 @@ main (int argc, char **argv)
&required_uid, &required_gid,
&u_dummy, &g_dummy);
if (e)
- error (EXIT_FAILURE, 0, "%s: %s", quote (optarg), e);
+ error (EXIT_FAILURE, 0, "%s: %s", e, quote (optarg));
break;
}
@@ -308,7 +308,7 @@ main (int argc, char **argv)
const char *e = parse_user_spec (argv[optind], &uid, &gid,
&chopt.user_name, &chopt.group_name);
if (e)
- error (EXIT_FAILURE, 0, "%s: %s", quote (argv[optind]), e);
+ error (EXIT_FAILURE, 0, "%s: %s", e, quote (argv[optind]));
/* If a group is specified but no user, set the user name to the
empty string so that diagnostics say "ownership :GROUP"