~vcs-imports/busybox/trunk

Viewing all changes in revision 16247.

  • Committer: Denys Vlasenko
  • Author(s): Ron Yorston
  • Date: 2019-04-19 11:21:34 UTC
  • Revision ID: git-v1:48645b83502a5add5429b6cbb19cf3a083f1adf4
ash: prevent error in backquotes in PS1 from exiting shell

Setting PS1 to:

   PS1='`xxx(`'

causes the shell to terminate with the error:

   sh: syntax error: unexpected end of file (expecting ")")

This happens because old-style backquotes require the input to be reread
and thus call setinputstring() a second time.  Prevent the problem by
unwinding all recently opened files in expandstr().

function                                             old     new   delta
unwindfiles                                            -      22     +22
expandstr                                            247     262     +15
forkchild                                            631     625      -6
evalcommand                                         1694    1685      -9
ash_main                                            1346    1336     -10
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/3 up/down: 37/-25)             Total: 12 bytes

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

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: