epics-modules / autosave

APS BCDA synApps module: autosave
https://epics-modules.github.io/autosave/
Other
8 stars 31 forks source link

Possible unexpanded macro #26

Open damib opened 5 years ago

damib commented 5 years ago

https://github.com/epics-modules/autosave/blob/3283ed19b7e2fcfc27b3b2dcef664a2ff97b69a7/asApp/src/dbrestore.c#L953

The code is going to concatenate two buffers after macro expansion, so a macro falling between the two buffers will not be expanded.

ralphlange commented 5 years ago

Isn't this about restoring an autosave file, i.e. a file that has been written using actual data from the database before? How is this related to macro expansion?

damib commented 5 years ago

Hi Ralph, you are right, nevertheless the code is currently expanding macro on those buffers (look at line 958), I don't know if this was on purpose or not, may be the macro substitution on the value string.

timmmooney commented 5 years ago

Yeah, this is a bug, alright. It does intend to expand a macro that could begin on one buffer and end in the next buffer. It should expand after concatenating. (It's unusual for autosave to restore a file that contains unexpanded macros. This happens only if the file was edited by hand, which I do for some files used by configMenu to hold softGlue circuits. It's handy if people can load an example circuit without having to edit the .cfg file so it has their IOC prefix.)

mark0n commented 5 years ago

Hmm, I'm wondering if it's really necessary to do macro expansion in autosave. Shouldn't it be the user's responsibility to expand macros if he chooses to put them in manually (e.g. using msi)?