Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: RFC PATCH: stop lowercasing messages from strerror
- X-seq: zsh-workers 55287
- From: "Daniel Shahaf" <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: RFC PATCH: stop lowercasing messages from strerror
- Date: Wed, 18 Nov 2026 17:49:10 +0000
- Archived-at: <https://zsh.org/workers/55287>
- Dkim2-signature: i=1; m=1; t=1795024173; d=daniel.shahaf.name; mf=PGQuc0BkYW5pZWwuc2hhaGFmLm5hbWU+; rt=PHpzaC13b3JrZXJzQHpzaC5vcmc+; s=fm2:rsa-sha256:pD/2cKIDAXMbNZPvR0VIyi9XSGUwUPzLhUwPjozEb6iBHy7 iCGy8w/qiMfzySTwmWenahfRR3BL7jGe5BGaKb1L8TXGSELj/gaTtmzYqSPkLWMk cu00CbT7ikEGGjLuI7jCsSCvUn9i+fX0Wv4P0ZRJ4lB7ZU3q4zAMjRHDnMA+tfdt lJIBCFJxc2r9J84XmC0IiXP43gy221tYlvgruIgY7nfm8y/mTfo9q9lLldRAtptf bZqaDTVN9wWgZ2CC123hkFBTltXsMq9hjdIVDnwHdjqalQIql0xwtY7djGaSRZR0 jP6lAY3Q6+XMF/1/S7bLcttciB1gGDHFTss+yeg==;
- Feedback-id: i425e4195:Fastmail
- In-reply-to: <20261117114933.22106-1-mikachu@gmail.com>
- List-id: <zsh-workers.zsh.org>
- Message-instance: m=1; h=sha256:lSNxaigjK15Pf0+L3y+8ZTDErefhQ98nQ1Lc1Xhh5PQ=:4GJrPipIlsOqgnnCbSrFjLJSRS4AlN3+TIg0xB82Jk8=;
- References: <1645687068.167019.1794909152720@mail.virginmedia.com> <20261117114933.22106-1-mikachu@gmail.com>
Mikael Magnusson wrote on Tue, 17 Nov 2026 11:49 +00:00:
> Originally reported in debian bug 419233 and forwarded as workers/23274.
>
> ---
>
>> It's not a uniform standard in English, even taking away the technical
>> issues (i.e. it's not simply a kludge in Bash), so from the language
>> point of view I don't think there's any problem in changing it.
>>
>> The issue is likely to be people matching on error messages in tests ---
Fair point. However, people having to update their tests is a one-time
cost, and by incurring it we align zsh's behaviour from here on with
most other tools' behaviour and, I therefore suspect, most people's
expectations.
Also, blindly lowercasing a word can change its meaning (e.g.,
"Polish", "Bob", [whatever the codename of the latest Ubuntu is]), so we
shouldn't do that.
Also, this lowercasing can create misspellings in English too — e.g.,
when the message starts with an acronym:
.
% errno -l | perl -anE 'say "@F" if $F[2] =~ /^[A-Z][A-Z]/'
EDOTDOT 73 RFS specific error
%
.
We shouldn't print "rFS specific error".
>> which could happen in other languages with Latin character sets, so
>> specialising English isn't a fix. I have absolutely no idea how common
>> this would turn out to be. I think we'd have to apply the patch and ask
>> people to look for knock-on effects.
>
> Here's a patch against the current code, including adjustments for our
> own tests, for reference.
>
> It would have been nice if strerror returned text in lower case, since
> uppercasing is somewhat less problematic, but I suppose it's a bit late
> to lobby for that.
>
> I also realized that my consistency argument somewhat falls on the fact
> that every other error message in zsh is still printed in lower case :).
>
> Even if we decide to keep the lowercasing, it should probably at least
> be made to work on multibyte text, or perhaps we should just use
> strerror_l when it exists (since POSIX.1-2008 if my manpage is to be
> believed) with a "C" locale so that all error messages are in english,
> since our other messages aren't translated anyway?
I would expect someone who runs with LC_MESSAGES=foo to prefer "some
messages are in foo and some are untranslated" to "all messages are untranslated".
Besides, even programs that do localize their messages still print
unlocalized messages when a particular message hasn't been translated;
i.e., it's not unheard of to see a bit of English in the middle of an
otherwise-localized session.
Cheers,
Daniel
> Src/utils.c | 11 +----------
> Test/A01grammar.ztst | 2 +-
> Test/A04redirect.ztst | 16 ++++++++--------
> Test/A08time.ztst | 2 +-
> Test/B01cd.ztst | 2 +-
> Test/E01options.ztst | 10 +++++-----
> 6 files changed, 17 insertions(+), 26 deletions(-)
>
> diff --git a/Src/utils.c b/Src/utils.c
> index 372d2a8283..bc036128b3 100644
> --- a/Src/utils.c
> +++ b/Src/utils.c
> @@ -296,7 +296,6 @@ zerrmsg(FILE *file, const char *fmt, va_list ap)
> int olderrno;
> char errbuf[ERRBUFSIZE];
> #endif
> - char *errmsg;
>
> if ((unset(SHINSTDIN) || locallevel) && lineno) {
> #if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
> @@ -353,15 +352,7 @@ zerrmsg(FILE *file, const char *fmt, va_list ap)
> errflag |= ERRFLAG_ERROR;
> return;
> }
> - errmsg = strerror(num);
> - /* If the message is not about I/O problems, it looks better *
> - * if we uncapitalize the first letter of the message */
> - if (num == EIO)
> - fputs(errmsg, file);
> - else {
> - fputc(tulower(errmsg[0]), file);
> - fputs(errmsg + 1, file);
> - }
> + fputs(strerror(num), file);
> break;
> /* When adding format codes, update the comment above zwarning(). */
> }
> diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
> index eea6ede2b3..906c6a4ca8 100644
> --- a/Test/A01grammar.ztst
> +++ b/Test/A01grammar.ztst
> @@ -647,7 +647,7 @@
>
> . ./nonexistent
> 127: Attempt to "." non-existent file.
> -?(eval):.:1: no such file or directory: ./nonexistent
> +?(eval):.:1: No such file or directory: ./nonexistent
Messages sorted by:
Reverse Date,
Date,
Thread,
Author