iocsh on vxWorks broken
Bug #2004463 reported by
Dirk Zimoch
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Committed
|
Critical
|
mdavidsaver |
Bug Description
Since commit 60128ee9 "Com: separate iocsh argument splitting", iocsh is broken on VxWorks (tested with version 6.9.4.12)
Any command prints the error "Unbalanced quote."
> iocsh
epics> echo
Unbalanced quote.
epics> "echo"
Unbalanced quote.
epics> "echo
Unbalanced quote.
epics> echo bla
Unbalanced quote.
epics> echo 1 2 3
Unbalanced quote.
epics> exit
Unbalanced quote.
I have started investigating....
To post a comment you must log in.
The reason is in iocsh.cpp line 363:
if (quote != EOF) {
Here, quote is 0xff but EOF is -1.
quote is initialized in line 265:
char quote = EOF;
The problem is the usage of EOF in function split().
On any architecture, where char is unsigned (e.g. VxWorks on PPC), the initialization
char quote = EOF;
sets quote to (char)-1 = 255.
Later, the comparison (quote != EOF) compares an unsigned char with the signed int literal -1. Thus the unsigned char gets promoted to a signed int with the same value 255 which is then then compared to -1. That is of course not equal.
The possible fixes are:
1. use signed char quote
2. use int quote
3. use 0 instead of EOF
I prefer solution 3. The attached patch has been created with commit 60128ee but can be applied to the current HEAD (bc54524) as well.