klibc-bot for Herbert Xu
2020-Mar-28 21:49 UTC
[klibc] [klibc:update-dash] dash: eval: Use the correct expansion mode for fd redirection
Commit-ID: 60413cc28c9b0b423e89fefff476d39c1926d6da Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=60413cc28c9b0b423e89fefff476d39c1926d6da Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Mon, 19 Nov 2018 18:00:32 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: eval: Use the correct expansion mode for fd redirection [ dash commit 70712c93c40a322056dafce7cbb45c727400936b ] It has been reported that echo test >&$EMPTY_VARIABLE causes dash to segfault. This is a symptom of the bigger problem that dash tries to perform pathname expansion as well as field splitting on the word after >& and <&. This is wrong and this patch fixes it to use the same expansions as done on a normal redirection. Reported-by: Andrej Shadura <andrew.shadura at collabora.co.uk> 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, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index dc0c9fa2..4981f156 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -529,7 +529,7 @@ expredir(union node *n) case NFROMFD: case NTOFD: if (redir->ndup.vname) { - expandarg(redir->ndup.vname, &fn, EXP_FULL | EXP_TILDE); + expandarg(redir->ndup.vname, &fn, EXP_TILDE | EXP_REDIR); fixredir(redir, fn.list->text, 1); } break;
Possibly Parallel Threads
- [git patch] klibc dash 0.5.4 update
- [klibc:update-dash] dash: eval: Add assignment built-in support again
- [klibc:update-dash] dash: builtin: Default to mktemp, not tempfile
- [klibc:update-dash] dash: eval: Report I/O error on stdout
- [klibc:update-dash] dash: main: Print \n upon EOF (CTRL-D) when run interactively