epics-base / epics-base

The C/C++ core of the EPICS Base control system toolkit
https://epics-controls.org/
Other
127 stars 137 forks source link

Cannot put json links using pvput #421

Open simon-ess opened 1 year ago

simon-ess commented 1 year ago

If you run the following:

$ pvput x.INP "{pva: \"foo\"}"

you get the error:

Error: At  : Failed to get field: pva (pva not found)

Note that this happens whether or not you quote (and properly escape) the pva, and this is true for other json link types (const, trace, etc.).

This does work correctly in the IOC shell with dbpf, however, as well as with caput.

This might be more properly an issue on https://github.com/epics-base/pvAccessCPP instead; note that the testing in pva2pva (https://github.com/epics-base/pva2pva/blob/3b9990e3650fca2673eebfb83645193ac0e5297d/testApp/testpvalink.cpp) tests using the IOC shell, not using pvput.

mdavidsaver commented 2 months ago

This is an issue with pvAccessCPP. I did not consider this case when defining the behavior of pvput where a plain JSON blob is treated as a write of the whole PVA structure. Explicitly specifying the PVA structure field value= will resolve the ambiguity.

pvput x.INP value="{pva: \"foo\"}"