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

Bug #1253128 reported by cpb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libECBUFR
Fix Committed
Low
vanh souvanlasy

Bug Description

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.

Revision history for this message
vanh souvanlasy (vanh-souvanlasy) wrote :

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.

Changed in libecbufr:
status: New → Confirmed
importance: Undecided → Low
status: Confirmed → Fix Committed
Revision history for this message
vanh souvanlasy (vanh-souvanlasy) wrote :

Missing line has been added.

Revision history for this message
cpb (chris-beauregard) wrote :

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.

Revision history for this message
vanh souvanlasy (vanh-souvanlasy) wrote :

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.

Revision history for this message
cpb (chris-beauregard) wrote :

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.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.