Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bufr_load_template() doesn't look like it should even work #61

Open
vsouvan opened this issue Apr 19, 2020 · 5 comments
Open

bufr_load_template() doesn't look like it should even work #61

vsouvan opened this issue Apr 19, 2020 · 5 comments

Comments

@vsouvan
Copy link
Collaborator

vsouvan commented Apr 19, 2020

bufr_load_template() contains:

EntryTableB *e;
...
if (strcmp( tok, "VALUE")==0)
...
if (e != NULL)

Problem is, e is never actually initialized anywhere. I'm not sure why it hasn't failed in production.


Imported from Launchpad using lp2gh.

@vsouvan
Copy link
Collaborator Author

vsouvan commented Apr 19, 2020

(by vanh-souvanlasy)
The missing line was: "e = bufr_fetch_tableB ( tbls, icode );" this line used to be there in previous versions, but seems to
have been deleted, a slipped finger on the keyboard probably.
This problem never came up because this part of the code is rarely or never used, it was meant to allow setting values within a template. Since most setting of values are done in datafile instead.

@vsouvan
Copy link
Collaborator Author

vsouvan commented Apr 19, 2020

(by vanh-souvanlasy)
Missing line has been added.

@vsouvan
Copy link
Collaborator Author

vsouvan commented Apr 19, 2020

(by chris-beauregard)
It actually looks like the template value assignment doesn't really work, since there's no way to leave an entry in the datafile "empty" such that it'll fall back to the template default. See the test case in r257. It's also possible that I'm just holding it wrong.

@vsouvan
Copy link
Collaborator Author

vsouvan commented Apr 19, 2020

(by vanh-souvanlasy)
It was a wrong idea trying to set values from within template file, which proved to be impossible because of all the expansions and replications. There is no pratical way to set those values. And it does not make sense to expand everything in a template. Which could be a simple Table D descriptor. This was an attempt made longtime ago, it was abandoned for setting values in DATAFILE only. This part of code was left in its initial state and never worked. It should be removed since it serve no more.

@vsouvan
Copy link
Collaborator Author

vsouvan commented Apr 19, 2020

(by chris-beauregard)
Fair enough. It doesn't work, and I certainly have no use for it myself; I only use the API(s) directly rather than external template/message files. I only noticed it while tracing the code paths relevant to bug #1250947.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant