cryptic error message "parse error: premature EOF"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
New
|
Undecided
|
Unassigned |
Bug Description
In EPICS 7, if an array input link (e.g. waveform.INP) is an explicit empty string, the parser prints a cryptic message without any helpful context.
Example:
record(waveform, "x")
{
field(INP, "")
}
dbConvertJSON: parse error: premature EOF
Not very enlightening.
It does not happen if INP is not set at all and it does not happen at least up to R3.16.1 but at least since 7.0.4.1 (I have not tested anything in between) and up to commit d82ab81.
It also does not happen with scalar input links (e.g. ai.INP).
First of all, any parser error should print a context (I prefer record.field) similar to this:
dbConvertJSON: parse error: premature EOF in x.INP
Unfortunately, dbPutConvertJSON (the function printing the dbConvertJSON message) does not have the context. All it has is the string. So maybe it should not print the message at all but leave it to the caller. The only callers are in dbConstLink.c. The interface should be modified to pass either the context (plink instead of plink->
Second, passing "" should not result in an error at all.
Other parser errors are missing context too:
dbConvertJSON: String provided, numeric value(s) expected
What was the string and where did it happen?