nasa / sample_app

The Core Flight System (cFS) Sample App (sample_app)
Apache License 2.0
50 stars 43 forks source link

Need to check the status of CFE_TBL_Load() call #147

Closed jphickey closed 1 year ago

jphickey commented 3 years ago

Describe the bug sample_app does not actually check the status returned by the call to CFE_TBL_Load(). As a result, if the filename is wrong or missing, it is not obvious that the app has not initialized itself fully, because it still prints the "SAMPLE App Initialized" message as usual.

To Reproduce Start CFE framework as normal but without the sample app table file present in the /cf directory. The sample app still starts "successfully" as reported in the message but the table is not loaded.

Expected behavior The app shouldn't report that it initialized if the table didn't load.

Code snips The status is saved to a local variable here, but nothing is done with it: https://github.com/nasa/sample_app/blob/1c32ed48ca358a3fdd55f1bdc9ae0dda61a4f4f7/fsw/src/sample_app.c#L210-L220

System observed on: Ubuntu 20.04

Additional context Surprising that this is not reported by static analysis, as it seems to be a case of variable assignment without use.

Also worth noting that table services itself does send an event about the failure to load the table, but it doesn't have much detail: EVS Port1 66/1/CFE_TBL 53: SAMPLE_APP: Unable to open file (FileDescriptor=-1)

If OSAL debug is enabled (OSAL_CONFIG_DEBUG_PRINTF) then the user does get a message on the console, at least on Linux, with more detail ("No such file or directory").

Reporter Info Joseph Hickey, Vantage Systems, Inc.