ash: catch error in arithmetic expansion in PS1
authorRon Yorston <rmy@pobox.com>
Thu, 18 Apr 2019 08:49:13 +0000 (09:49 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 19 Apr 2019 11:21:34 +0000 (13:21 +0200)
commitd1a2fa2a4e013960bf56dfef8a71ed2d08fc756b
tree6d47b357fbc99a10fa026b969b8e53200b69681e
parent48645b83502a5add5429b6cbb19cf3a083f1adf4
ash: catch error in arithmetic expansion in PS1

Setting PS1 to:

   PS1='$((123+))'

causes the shell to enter an infinite error loop:

   sh: arithmetic syntax error

Catch any exception raised by expandarg() in expandstr() and allow
processing to continue.

function                                             old     new   delta
expandstr                                            262     344     +82
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 82/0)               Total: 82 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c