[klibc] [klibc:update-dash] dash: eval: Report I/O error on stdout

klibc-bot for Gerrit Pape pape at smarden.org
Sat Mar 28 14:49:31 PDT 2020


Commit-ID:  9adc45f99d817c34e9ac95d240f54dd2bb4970c2
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=9adc45f99d817c34e9ac95d240f54dd2bb4970c2
Author:     Gerrit Pape <pape at smarden.org>
AuthorDate: Fri, 7 Sep 2018 10:34:13 +0200
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:55 +0000

[klibc] dash: eval: Report I/O error on stdout

[ dash commit 8e43729547b57ab15842dab23215336a353b2ded ]

ENOSPC as a result of an echo builting failing gives no diagnostic.
Just as other shells, dash sets $? to 1, but aside from terminating
the script, this does not inform the user what the problem is:

zsh:
    % echo foo > /dev/full
    echo: write error: no space left on device

bash:
    $ echo foo > /dev/full
    bash: echo: write error: No space left on device

dash:
    $ echo foo > /dev/full
    [nothing]

Print an error to stderr like the other shells.

Suggested by Roger Leigh.

Signed-off-by: Gerrit Pape <pape at smarden.org>
[reworded the patch description with information from the bug]
Signed-off-by: Andrej Shadura <andrew.shadura at collabora.co.uk>
Bug-Debian: http://bugs.debian.org/690473
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/eval.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 6652ccc0..01bc5234 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -952,6 +952,8 @@ evalbltin(const struct builtincmd *cmd, int argc, char **argv, int flags)
 	else
 		status = (*cmd->builtin)(argc, argv);
 	flushall();
+	if (outerr(out1))
+		warnx("%s: I/O error", commandname);
 	status |= outerr(out1);
 	exitstatus = status;
 cmddone:


More information about the klibc mailing list