bug-gnulib
[Top][All Lists]
Advanced

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

Re: error.c: "Unknown system error" should report errno value


From: Eric Blake
Subject: Re: error.c: "Unknown system error" should report errno value
Date: Mon, 24 Sep 2007 21:37:26 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[adding gnulib, as this problem is really a gnulib one, not a coreutils]

According to Martin Koeppe on 9/24/2007 5:46 PM:
> 
> On Mon, 24 Sep 2007, Paul Eggert wrote:
> 
>> Martin Koeppe <address@hidden> writes:
>>
>>> +      s = _("Unknown system error");
>>> +      fprintf (stderr, ": %s (errno=%d)", s, errnum);
>>
>> I like the idea, but that "errno=" grates a bit, as user diagnostics
>> shouldn't be so low-level.  How about this instead?
>>
>>  fprintf (stderr, _(": Unknown system error number %d"), errnum);
> 
> Ok, I could live with that. My idea was not to change the original
> string to avoid re-translation and to give a clear hint what this number
> is meant to be, i.e. that's an errno value. The number alone is probably
> of no use to any "normal" user anyway. (Though I first had only "(%d)"
> myself.)

The Austin group debated making the next version of POSIX required to
always return a non-NULL result for strerror (although for out-of-range
errors, there was no guarantee that the string had to be unique, as in
printing what the out-of-range value was).  However, I think that proposal
has stalled, so the Interix behavior of returning NULL for strerror(-1) is
not yet non-POSIX compliant.  I am very much in favor of a gnulib
implementation of strerror that works harder to provide non-NULL results.

> OTOH if strerror() cannot resolve the errno value, then there
> is probably a bigger problem in it, not a normally occuring case
> (generating a user level diagnostic has just failed!), and debugging
> should be made easy. I also think it's a good idea to have ":" and "%d"
> not within the string for easy and uniform translations.

Actually, gettext encourages putting %d in the translation, so that
languages that use pluralization rules in their translation can deal with
it better.  In other words, Paul's suggested wording is better.

For reference, here's what cygwin does with unknown errors:

"Unknown error %u"

without translation (but then again, cygwin lacks builtin translation).

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG+IJ284KuGfSFAYARAqfAAJ9qulY2G/MT6OaTYAIi0lxU/qFSuACZAZz0
H3Q0B0nThfZQHDJ5Zpywu0Y=
=Idym
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]