Comment 18 for bug 1882520

Revision history for this message
Andrew Johnson (anj) wrote :

I think a bigger surprise would be a site that developed a record naming convention that carefully followed our published naming rules and then found out that they can't upgrade EPICS because we changed those rules. Some EPICS sites don't have developers who have time to read every tech-talk message, and that possibility troubles me.

If you don't like surprises, don't use the [] constant array syntax at all, use {const:[...]} instead as the JSON parser does follow the spec. The current parser (without your change) gives these occasionally surprising results:

field(INP, [1]) INP : DB_LINK [1] NPP NMS
field(INP, [1,2]) INP : CONSTANT [1,2]
field(INP, "[1]") INP : DB_LINK [1] NPP NMS
field(INP, "[1,2]") INP : CONSTANT [1,2]
field(INP, [a]) INP : CONSTANT ["a"]
field(INP, [a,b]) INP : CONSTANT ["a","b"]
field(INP, "[a]") INP : DB_LINK [a] NPP NMS
field(INP, "[a,b]") INP : CONSTANT [a,b] <-- This generates a parse error at iocInit

The INP: part on each line is from a dbpr of the record and shows plink->type.

Applying your patch converts the 3 DB_LINKs into CONSTANTs, and adds a second parse error:

field(INP, [1]) INP : CONSTANT [1]
field(INP, [1,2]) INP : CONSTANT [1,2]
field(INP, "[1]") INP : CONSTANT [1]
field(INP, "[1,2]") INP : CONSTANT [1,2]
field(INP, [a]) INP : CONSTANT ["a"]
field(INP, [a,b]) INP : CONSTANT ["a","b"]
field(INP, "[a]") INP : CONSTANT [a] <-- Parse error at iocInit
field(INP, "[a,b]") INP : CONSTANT [a,b] <-- Parse error at iocInit

Links that give parse errors do not initialize their record at all. I know exactly why they happen so don't waste time investigating them, I have a fix in the works when we introduce the JSON-5 version of the YAJL parser, although putting array constants inside quotes isn't really correct anyway.