Incorrect error message when BUFR_TABLES environment variable is undefined

Bug #1250947 reported by Yves Pelletier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libECBUFR
Fix Committed
High
vanh souvanlasy

Bug Description

Currently, if BUFR_TABLES is undefined, the libecbufr utility bufr_encoder will stop with an error message stating that the template is not defined properly. This is because bufr_encoder cannot find the tables and therefore is unable to read the template. The template is probably just fine. So the message is erroneous and could be considered a bug. The root cause of the issue is that the BUFR_TABLES variable is undefined - this is what needs to be reported to the user in order to take proper action.

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

Strictly speaking, BUFR_TABLES doesn't *need* to be defined for bufr_encoder to work... one could imagine a template using purely local descriptors and -ltableb/-ltabled arguments (actually, I think that would fail in some situations; I can't decide if it's a bug or just good taste ;)

And (this is the real gotcha) local and master tables can be defined within a template file (LOCAL_TABLEB, MASTER_TABLED, etc), the interpretation of which is buried in the API call bufr_load_template() called by bufr_encoder to handle the -template command-line argument.

In other words, if bufr_encoder has no tables defined via BUFR_TABLES or the command line switches, it's not necessarily a usage error and isn't guaranteed to fail.

The design of the API is such that it turns out that bufr_encoder still can't expect when trying to load a template file that not having tables set/provided will be an error, or the precise nature of the error (i.e. distinguishing between missing tables or templates using descriptors not found in the tables provided/available).

In other words, from the perspective of the encoder and API, not having any tables provided is exactly the same situation as a template using descriptors not available in the various provided tables. The real problem, in a sense, is that the error from the API level is actually buried in the various debug messages.

I don't have a solution to propose off hand. I touched on this problem somewhat in bug #697746 , and it's a bit of a can of worms.

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

<sigh> And in the process of looking at this, I noticed bug #1253128

Revision history for this message
Yves Pelletier (yves-pelletier) wrote : RE: [Bug 1250947] Re: Incorrect error message when BUFR_TABLESenvironment variable is undefined
Download full text (3.4 KiB)

`Chris,

I understand that, given certain usage scenarios, the use of BUFR_TABLES to define the location of the BUFR tables is not essential. And I think I made a point approaching what you say in my bug submission. But my main point is that in its current form, in what we bill as the default usage scenario, when BUFR_TABLES is undefined the resulting error message is misleading and unhelpful. I would be happy with a simple warning that BUFR_TABLES is undefined, alongside (not replacing) the other message suggesting that there is an issue in the template. Last week I watched (and helped) as 20 people who were familiarizing themselves with libecbufr struggled to fix perfectly good templates, when all they needed to do is set the BUFR_TABLES variable in their environment.

Yves

-----Message d'origine-----
De : <email address hidden> [mailto:<email address hidden>] De la part de cpb
Envoyé : 20 November, 2013 10:30
À : Pelletier,Yves [CMC]
Objet : [Bug 1250947] Re: Incorrect error message when BUFR_TABLESenvironment variable is undefined

Strictly speaking, BUFR_TABLES doesn't *need* to be defined for bufr_encoder to work... one could imagine a template using purely local descriptors and -ltableb/-ltabled arguments (actually, I think that would fail in some situations; I can't decide if it's a bug or just good taste ;)

And (this is the real gotcha) local and master tables can be defined within a template file (LOCAL_TABLEB, MASTER_TABLED, etc), the interpretation of which is buried in the API call bufr_load_template() called by bufr_encoder to handle the -template command-line argument.

In other words, if bufr_encoder has no tables defined via BUFR_TABLES or the command line switches, it's not necessarily a usage error and isn't guaranteed to fail.

The design of the API is such that it turns out that bufr_encoder still can't expect when trying to load a template file that not having tables set/provided will be an error, or the precise nature of the error (i.e.
distinguishing between missing tables or templates using descriptors not found in the tables provided/available).

In other words, from the perspective of the encoder and API, not having any tables provided is exactly the same situation as a template using descriptors not available in the various provided tables. The real problem, in a sense, is that the error from the API level is actually buried in the various debug messages.

I don't have a solution to propose off hand. I touched on this problem somewhat in bug #697746 , and it's a bit of a can of worms.

--
You received this bug notification because you are subscribed to the bug report.
https://bugs.launchpad.net/bugs/1250947

Title:
  Incorrect error message when BUFR_TABLES environment variable is
  undefined

Status in Environment Canada BUFR Library:
  New

Bug description:
  Currently, if BUFR_TABLES is undefined, the libecbufr utility
  bufr_encoder will stop with an error message stating that the template
  is not defined properly. This is because bufr_encoder cannot find the
  tables and therefore is unable to read the template. The template is
  probably just fine. So the message ...

Read more...

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

On 11/20/13 10:54, Yves Pelletier wrote:
> Last
> week I watched (and helped) as 20 people who were familiarizing
> themselves with libecbufr struggled to fix perfectly good templates,
> when all they needed to do is set the BUFR_TABLES variable in their
> environment.

That does sound like an annoying experience.

One "quick hack" to fix what you encountered there is to have the
libecbufr .deb add a BUFR_TABLES environment setting to the stock config
(in /etc/profile.d/ on Ubuntu and I believe newer Debian's).

Wouldn't necessarily fix the underlying problem of an unhelpful error
message, but it would at least ensure that typical libecbufr
installations don't normally lack BUFR_TABLES.

c.

Changed in libecbufr:
milestone: none → 0.8.6
Changed in libecbufr:
assignee: nobody → vanh souvanlasy (vanh-souvanlasy)
status: New → In Progress
Revision history for this message
vanh souvanlasy (vanh-souvanlasy) wrote :

Added an error message saying :
Warning: env.var. BUFR_TABLES not defined
when trying to run decoder or encoder without defining this env. variable

Changed in libecbufr:
status: In Progress → Fix Committed
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.