Bug 10371

Summary: shell (ash?) PS1 can cause infinite loop of "sh: syntax error: unterminated quoted string"
Product: Busybox Reporter: avih <avihpit>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

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.