Bug 10371 - shell (ash?) PS1 can cause infinite loop of "sh: syntax error: unterminated quoted string"
Summary: shell (ash?) PS1 can cause infinite loop of "sh: syntax error: unterminated q...
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-06 15:12 UTC by avih
Modified: 2017-10-12 17:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description avih 2017-10-06 15:12:57 UTC
Tested With (git master) busybox sh, as well as earlier pre-built busybox versions, and on more than one platform.

Try to set PS1 as follows, notice the missing end-quote for date's format:

export PS1='$(date "+%H:%M:%S) > '

The shell enters infinite loop of printing:
"sh: syntax error: unterminated quoted string"

I could not abort it with ^C, ^D or ^Z, and had to kill busybox from elsewhere.

I got the same issue with unterminated quote in printf at the subshell.

I could _not_ reproduce the issue with other errors. E.g. I tried non-existing commands or other syntax errors, and it just printed the error as part of the prompt - reasonable behavior.
Comment 1 Denys Vlasenko 2017-10-12 17:36:48 UTC
Fixed in git.