Hi, This may be too small to bother with (if so I'll know next time), but I was reading standards.txt, and noticed the following in section 4.4 on formatting error messages:
---- The string MESSAGE should not begin with a capital letter when it follows a program name and/or file name, because that isn't the beginning of a sentence. (The sentence conceptually starts at the beginning of the line.) Also, it should not end with a period. ---- Which rang a bell from a section of src/wc.c I was reading yesterday that I happened to notice ended an error message with a period. So I ran the following in src: $ grep error *.c | perl -e '/"[A-Z]|\."/ and print while (<STDIN>);' and found a few more, which I changed to conform to the format specified in standards.txt. I also noticed that there were several instances of messages starting with 'WARNING:', or 'FATAL:', and two instances of 'Warning:'. The standards don't seem to mention any convention there, but I changed the 'Warning' cases to 'WARNING', just for consistency. This may be a case of historical behavior being the best convention, as I'm sure there are users out there parsing error output from these utilities and relying on the current messages (I had to change two tests that were doing just that). If not, please see the attached patch. Thanks, Bo
From 78fe032d5d0c64fe0bbb9717cffce6b9bde1f44b Mon Sep 17 00:00:00 2001 From: Bo Borgerson <[EMAIL PROTECTED]> Date: Fri, 4 Apr 2008 11:13:13 -0400 Subject: [PATCH] Standardize some error messages. src/expr.c: Standardize some error messages. src/install.c: Likewise. src/pr.c: Likewise. src/split.c: Likewise. src/wc.c: Likewise. tests/misc/wc-files0-from: Expect new error message. tests/misc/xstrtol: Likwise. Signed-off-by: Bo Borgerson <[EMAIL PROTECTED]> --- src/expr.c | 4 ++-- src/install.c | 10 +++++----- src/pr.c | 4 ++-- src/split.c | 2 +- src/wc.c | 2 +- tests/misc/wc-files0-from | 2 +- tests/misc/xstrtol | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/expr.c b/src/expr.c index cd498f6..f5b3415 100644 --- a/src/expr.c +++ b/src/expr.c @@ -780,9 +780,9 @@ eval2 (bool evaluate) if (errno) { error (0, errno, _("string comparison failed")); - error (0, 0, _("Set LC_ALL='C' to work around the problem.")); + error (0, 0, _("set LC_ALL='C' to work around the problem")); error (EXPR_INVALID, 0, - _("The strings compared were %s and %s."), + _("the strings compared were %s and %s"), quotearg_n_style (0, locale_quoting_style, l->u.s), quotearg_n_style (1, locale_quoting_style, r->u.s)); } diff --git a/src/install.c b/src/install.c index 1d04373..5318a35 100644 --- a/src/install.c +++ b/src/install.c @@ -412,8 +412,8 @@ main (int argc, char **argv) case PRESERVE_CONTEXT_OPTION: if ( ! selinux_enabled) { - error (0, 0, _("Warning: ignoring --preserve-context; " - "this kernel is not SELinux-enabled.")); + error (0, 0, _("WARNING: ignoring --preserve-context; " + "this kernel is not SELinux-enabled")); break; } x.preserve_security_context = true; @@ -422,8 +422,8 @@ main (int argc, char **argv) case 'Z': if ( ! selinux_enabled) { - error (0, 0, _("Warning: ignoring --context (-Z); " - "this kernel is not SELinux-enabled.")); + error (0, 0, _("WARNING: ignoring --context (-Z); " + "this kernel is not SELinux-enabled")); break; } scontext = optarg; @@ -479,7 +479,7 @@ main (int argc, char **argv) { if (target_directory) error (EXIT_FAILURE, 0, - _("Cannot combine --target-directory (-t) " + _("cannot combine --target-directory (-t) " "and --no-target-directory (-T)")); if (2 < n_files) { diff --git a/src/pr.c b/src/pr.c index 77d4c8a..60e06ac 100644 --- a/src/pr.c +++ b/src/pr.c @@ -914,7 +914,7 @@ main (int argc, char **argv) error (EXIT_FAILURE, 0, _("`--pages=FIRST_PAGE[:LAST_PAGE]' missing argument")); else if (! first_last_page (oi, 0, optarg)) - error (EXIT_FAILURE, 0, _("Invalid page range %s"), + error (EXIT_FAILURE, 0, _("invalid page range %s"), quote (optarg)); break; } @@ -2395,7 +2395,7 @@ print_header (void) print_white_space (); if (page_number == 0) - error (EXIT_FAILURE, 0, _("Page number overflow")); + error (EXIT_FAILURE, 0, _("page number overflow")); /* The translator must ensure that formatting the translation of "Page %"PRIuMAX does not generate more than (sizeof page_text - 1) diff --git a/src/split.c b/src/split.c index f84d40e..9372e03 100644 --- a/src/split.c +++ b/src/split.c @@ -190,7 +190,7 @@ next_file_name (void) sufindex[i] = 0; outfile_mid[i] = suffix_alphabet[sufindex[i]]; } - error (EXIT_FAILURE, 0, _("Output file suffixes exhausted")); + error (EXIT_FAILURE, 0, _("output file suffixes exhausted")); } } diff --git a/src/wc.c b/src/wc.c index 61ab485..c18948e 100644 --- a/src/wc.c +++ b/src/wc.c @@ -633,7 +633,7 @@ main (int argc, char **argv) { error (0, 0, _("extra operand %s"), quote (argv[optind])); fprintf (stderr, "%s\n", - _("File operands cannot be combined with --files0-from.")); + _("file operands cannot be combined with --files0-from")); usage (EXIT_FAILURE); } diff --git a/tests/misc/wc-files0-from b/tests/misc/wc-files0-from index 61340d6..f9b17ed 100755 --- a/tests/misc/wc-files0-from +++ b/tests/misc/wc-files0-from @@ -39,7 +39,7 @@ my @Tests = # invalid extra command line argument ['f-extra-arg', '--files0-from=- no-such', {IN=>"a"}, {EXIT=>1}, {ERR => "$prog: extra operand `no-such'\n" - . "File operands cannot be combined with --files0-from.\n" + . "file operands cannot be combined with --files0-from\n" . "Try `$prog --help' for more information.\n"} ], diff --git a/tests/misc/xstrtol b/tests/misc/xstrtol index 874b4a5..25125ce 100755 --- a/tests/misc/xstrtol +++ b/tests/misc/xstrtol @@ -51,7 +51,7 @@ my @Tests = # FIXME: should be lower case "invalid". ['inv-pg-range', "--pages=9x", {EXIT => 1}, - {ERR=>"$prog: Invalid page range `9x'\n"}], + {ERR=>"$prog: invalid page range `9x'\n"}], ); my $save_temps = $ENV{DEBUG}; -- 1.5.2.5
_______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils