Re: Bug in Dash's unquoting of backslashes within backquoted strings

2020-05-21 Thread Ron Yorston
Ron Yorston wrote: >This seems to have been introduced by commit 6bbc71d (parser: use >pgetc_eatbnl() in more places). Reverting the following part of the >commit makes the problem go away: > >case '\\': >-if ((pc

Re: Bug in Dash's unquoting of backslashes within backquoted strings

2020-05-21 Thread Ron Yorston
Matt Whitlock wrote: >A minimal example: > >: `: " >\\$(bug)"` >However, when it appears inside a backquoted subcommand (with the >backslash characters being appropriately escaped), such as given at the top >of this report, then Dash processes it incorrectly: > >/bin/sh: 1: bug: not found

Re: [v2 PATCH] eval: avoid leaking memory associated with redirections

2018-12-14 Thread Ron Yorston
Herbert Xu wrote: >I thinkg we should just move the stack mark into evaltree for >everybody, like this: Thanks for looking at this. I've tried the revised patch and it does the job. I've ported it to BusyBox ash where it's also effective and passes the test suite. Plus it saves 67 byte, which

[PATCH] eval: avoid leaking memory associated with redirections

2018-11-22 Thread Ron Yorston
The following constructs result in ever-increasing memory usage: while true; do { true; } https://bugs.busybox.net/show_bug.cgi?id=7748 Signed-off-by: Ron Yorston --- src/eval.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/eval.c b/src/eval.c index 546ee1b..9f117ea 100644

Re: [PATCH] parser: preserve characters on heap in backquote parsing

2018-11-19 Thread Ron Yorston
Herbert Xu wrote: >Sorry, but this is not the only place where dash relies on alloca. >So you're bound to run into this problem again if you have a script >that attempts to push dash to use more than 8MB in places like this. Sure, but the same problem existing in other places isn't a reason not

Re: [PATCH] var: ensure variables are fully initialised when unset

2018-11-12 Thread Ron Yorston
Harald, Thanks for pointing out the flaw in my reasoning. I can confirm your alternative patch is effective in eradicating the bug. Cheers, Ron

[PATCH] parser: preserve characters on heap in backquote parsing

2018-11-11 Thread Ron Yorston
test_case test_case: 3141: test_case: Syntax error: Unterminated quoted string If the heap is reduced to the same size as the stack, 8MB: $ ulimit -S -d 8192 $ dash test_case test_case: 0: test_case: Out of space Signed-off-by: Ron Yorston --- src/parser.c | 3 +-- 1 file changed, 1

Re: Command substitution in here-documents

2018-08-16 Thread Ron Yorston
I've been continuing to worry about this. In the old code (prior to commit 7c245aa) the TNL token that was detected in list() had actually been read. The current code uses peektoken(). When parseheredoc() is called in interactive mode the last call to readtoken() is in the code to set the

Re: Command substitution in here-documents

2018-08-13 Thread Ron Yorston
Simon Ser wrote: >On August 13, 2018 4:22 PM, Martijn Dekker wrote: >> - The latest release is 0.5.10.2. I can't reproduce the bug at all in >> 0.5.10, 0.5.10.1 or 0.5.10.2. > >This is interesting. I can reproduce with the latest commit in master. I'm with Simon, the bug is present in

Re: Command substitution in here-documents

2018-08-11 Thread Ron Yorston
Simon Ser wrote: >I'm trying to use command substitution in here-documents. Here's my script: > > cat < `echo hi` > EOF > >This seems not to work in dash 0.5.9.1. It fails with this error: > > dash: 1: > : not found 'git bisect' points to commit 7c245aa8ed33ba5db30eef9369d67036a05b0371

Re: [PATCH] expand: remove unnecessary code in backquote expansion

2018-04-19 Thread Ron Yorston
Herbert Xu wrote: >Unfortunately we may need this at some point in the future due >to changes in POSIX. So let's keep it around for now until we >get things such as `jobs -p` to work. As you wish. Something even more trivial I noticed later: the TRACE at the end

[PATCH] expand: remove unnecessary code in backquote expansion

2018-04-10 Thread Ron Yorston
r. Remove: - the buf and nleft elements of the backcmd structure; - a misleading comment regarding handling of builtins. Signed-off-by: Ron Yorston <r...@frippery.org> --- src/eval.c | 12 src/eval.h | 2 -- src/expand.c | 31 ++- 3 files changed, 14 i