Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RFC PATCH: stop lowercasing messages from strerror
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 ---
> 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?
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
echo '[[' >bad_syntax
. ./bad_syntax
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index aa4b74562c..14636503de 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -466,46 +466,46 @@
echo output'
0:failed exec redir, no POSIX_BUILTINS
>output
-?zsh:1: no such file or directory: ./nonexistent/nonexistent
+?zsh:1: No such file or directory: ./nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -o POSIX_BUILTINS -c '
exec >./nonexistent/nonexistent
echo output'
1:failed exec redir, POSIX_BUILTINS
-?zsh:2: no such file or directory: ./nonexistent/nonexistent
+?zsh:2: No such file or directory: ./nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -o POSIX_BUILTINS -c '
set >./nonexistent/nonexistent
echo output'
1:failed special builtin redir, POSIX_BUILTINS
-?zsh:2: no such file or directory: ./nonexistent/nonexistent
+?zsh:2: No such file or directory: ./nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -o POSIX_BUILTINS -c '
command set >./nonexistent/nonexistent
echo output'
0:failed special builtin redir with command prefix, POSIX_BUILTINS
>output
-?zsh:2: no such file or directory: ./nonexistent/nonexistent
+?zsh:2: No such file or directory: ./nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -o POSIX_BUILTINS -c '
echo >./nonexistent/nonexistent
echo output'
0:failed unspecial builtin redir, POSIX_BUILTINS
>output
-?zsh:2: no such file or directory: ./nonexistent/nonexistent
+?zsh:2: No such file or directory: ./nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -o POSIX_BUILTINS -c '
. ./nonexistent/nonexistent
echo output'
1:failed dot, POSIX_BUILTINS
-?zsh:.:2: no such file or directory: ./nonexistent/nonexistent
+?zsh:.:2: No such file or directory: ./nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -c '
. ./nonexistent/nonexistent
echo output'
0:failed dot, NO_POSIX_BUILTINS
>output
-?zsh:.:2: no such file or directory: ./nonexistent/nonexistent
+?zsh:.:2: No such file or directory: ./nonexistent/nonexistent
$ZTST_testdir/../Src/zsh -f -o CONTINUE_ON_ERROR <<<'
readonly foo
@@ -720,4 +720,4 @@
0:CLOBBER_EMPTY
>Works
>Works
-?(eval):6: file exists: foo
+?(eval):6: File exists: foo
diff --git a/Test/A08time.ztst b/Test/A08time.ztst
index ee4d28c88b..7609d7d722 100644
--- a/Test/A08time.ztst
+++ b/Test/A08time.ztst
@@ -99,7 +99,7 @@
time /no/such/commmand
127:`time' of nonexistent external
-*?*no such file or directory: /no/such/commmand
+*?*No such file or directory: /no/such/commmand
*?*user*system*cpu*total
( setopt errexit; time false; print notreached )
diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst
index e313414781..446a065ccc 100644
--- a/Test/B01cd.ztst
+++ b/Test/B01cd.ztst
@@ -139,7 +139,7 @@ F:something is broken. But you already knew that.
pwd2=$(pwd -P)
[[ $pwd1 = $pwd2 ]] || print "Ooops, changed to directory '$pwd2'"
0:
-?(eval):cd:3: not a directory: link_to_nonexistent
+?(eval):cd:3: Not a directory: link_to_nonexistent
(unset HOME; ARGV0=sh $ZTST_testdir/../Src/zsh -c cd)
1:Implicit cd with unset HOME.
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index bcca69db7f..44a4809056 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -226,8 +226,8 @@
cd cdablevar2
1q:CDABLE_VARS option
>back in options.tmp
-?(eval):cd:4: no such file or directory: cdablevar1
-?(eval):cd:10: no such file or directory: cdablevar2
+?(eval):cd:4: No such file or directory: cdablevar1
+?(eval):cd:10: No such file or directory: cdablevar2
# CHASE_DOTS should go with CHASE_LINKS in B01cd.ztst
# which saves me having to write it here.
@@ -261,8 +261,8 @@
>wimpole
>royston
>foxton
-?(eval):4: file exists: foo1
-?(eval):6: no such file or directory: bar1
+?(eval):4: File exists: foo1
+?(eval):6: No such file or directory: bar1
setopt cshjunkieloops
eval 'for f in swaffham bulbeck; print $f; end'
@@ -842,7 +842,7 @@
>File in upper dir
>File in lower dir
>unsetting option...
-?(eval):14: no such file or directory: pathtestdir/findme
+?(eval):14: No such file or directory: pathtestdir/findme
(setopt pathdirs; path+=( /usr/bin ); type ./env)
1:whence honours PATH_DIRS option
--
2.38.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author