[PATCH 4/6] eval: Avoid crash when redirecting to file descriptor in expredir

2018-09-07 Thread Andrej Shadura
From: Bernhard Übelacker When trying to redirect output to a filedescriptor contained in an environment variable, but if that variable is empty, dash crashes with a segmentation fault. To reproduce, run the following: echo test >&$EMPTY_VARIABLE Signed-off-by: Andrej Shadura Bug-Debian:

[PATCH 3/6] mkbuiltins: Default to mktemp, not tempfile

2018-09-07 Thread Andrej Shadura
Don't use tempfile, as it currently runs tempnam(), which is insecure and fails under pseudo(1). Signed-off-by: Andrej Shadura --- src/mkbuiltins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mkbuiltins b/src/mkbuiltins index b4d6f4e..f1f2593 100644 ---

[PATCH 1/6] exec: Don't execute binary files if execve() returned ENOEXEC.

2018-09-07 Thread Andrej Shadura
From: Adam Borowski Both "dash -c foo" and "./foo" are supposed to be able to run hashbang-less scripts, but attempts to execute common binary files tend to be nasty: especially both ELF and PE tend to make dash create a bunch of files with unprintable names, that in turn confuse some tools up

Debian patches for dash

2018-09-07 Thread Andrej Shadura
Hi, I’m submitting the patches we’ve had applied to dash in Debian for some time. I have rewritten the patch descriptions to include more information from the bug reports to make sure commit messages make more sense and help understand the purpose of the changes. I hope you find those patches

[PATCH 5/6] eval: Report I/O error on stdout

2018-09-07 Thread Andrej Shadura
From: Gerrit Pape 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

[PATCH 2/6] printf: Support \e in "echo" and "printf" builtins.

2018-09-07 Thread Andrej Shadura
From: Adam Borowski dash's builtin version of printf doesn't support '\e' (escape), and literaly outputs the 2 characters as-is. As is well known, this sequence is useful, for example, when outputting ANSI escape sequences. While it seems that POSIX does not require that printf support '\e', it