-
Notifications
You must be signed in to change notification settings - Fork 201
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
CFE_TBL_Load returns CFE_SUCCESS when initially loading an incomplete image file (CFE_TBL_WARN_SHORT_FILE internally) #1861
Comments
Ping @skliper - need to decide whether this gets fixed for Caelum or just put in "known bugs" and deferred to next release (or better yet, rewrite of TBL). AFAIK, "partial table loads" are a little-used (and little-tested) feature of TBL. |
I used them in a previous project and they were extremely helpful since we had a pretty large parameter table |
After adding a lot more combinations and table content checks, this (luckily) seems to be a little more limited in scope than what I was worried about. To summarize, the only "bad" outcome I've been able to confirm is that if the table hasn't yet been fully loaded and the user calls After tracing through the code, it looks like there is no path whereby the internal warning codes An interesting discrepancy is that if the partial image file starts at a nonzero offset, it is detected and |
To summarize - the issue here is really in regard to consistency in how partial images on initial loads are detected. The code catches the case of loading a "second half" partial image (nonzero start offset) and translates to an error (CFE_TBL_ERR_PARTIAL_LOAD) to indicate the loaded image in memory is not complete. However the exact same condition with a "first half" partial image (one that starts at offset 0) it does not catch and it returns SUCCESS - not correct. This should also be an error, because the image in memory is just as incorrect (half-loaded). |
Note the rational in the CFE_TBL_Load associated requirement: cFE/docs/cFE_FunctionalRequirements.csv Line 451 in 5e41330
The rational seems be be saying this is intended behavior... initializing a table using CFE_TBL_Load with data starting at zero that doesn't fill the entire table isn't an error (unlike the requirements which including generating an error). Although I agree it should return some indication via the status code, but loading and using "short" tables seems to be the original intent. The path forward here may just be the redesign to remove the "partial load" concept from TBL in favor of file management which provides the same capabilities (upload/manage small chunks, assemble into a table, THEN load vs loading the individual small chunks and all the challenges of managing a partial load within TBL). You probably could still load a "short" file if that's really what is being required here... but it is a strange inconsistency between loading via command and loading via API (typically just at table initialization). |
Interesting. I must admit I can't quite grasp how loading only the first half of a table is OK, while loading only the second half of a table is an error. But nonetheless, if that's the intended behavior, then the implementation seems to be meeting that requirement. Perhaps this bug should get categorized into the TBL requirements domain / redesign issues. |
@jwilmot or @dmccomas may know better, but my guess would be related to the concept of a table containing a large array w/ unused slots (and an "end" marker). Something like an RTS or similar where the generic max table size may be 50... but the actual table only contains data for the first 3 slots (and a special 4 entry signifying the end). So it would be still an error to initialize with something that started at slot 7 (or whatever) since the previous slots would be garbage, but not to have a short table w/ an end marker. |
Describe the bug
During a
CFE_TBL_Load
call, the function is expected to return an error code if the loaded file was not complete (i.e. does not result in a complete image in memory).In this case, if the image started at offset 0, but had fewer bytes than required for a complete table), it triggers the
CFE_TBL_WARN_SHORT_FILE
status internally inside CFE_TBL_LoadFromFile, but then this gets overwritten to CFE_SUCCESS in CFE_TBL_Load, making the return value to the user seem like the table was fully loaded/valid.To Reproduce
Call
CFE_TBL_Load()
on a table which has not been initially loaded with a partial data file.Expected behavior
Should return an error not
CFE_SUCCESS
, because the table image is only half loaded.System observed on:
Ubuntu
Additional Context
Found as part of scrub in #1724
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: