nasa / fprime

F´ - A flight software and embedded systems framework
https://fprime.jpl.nasa.gov
Apache License 2.0
9.95k stars 1.28k forks source link

FPrime GDS does not gracefully handle files downlinks of the same filename #2730

Open rrieber opened 1 month ago

rrieber commented 1 month ago

Say an FPrime spacecraft downlinks filename.bin, then downlinks the same file a second time for redundancy. The current behavior of FPrime GDS would be to overwrite the first filename.bin with the second. If there were undetected corruption or other issues, those would be permanently imprinted on the final version of the file.

Let's explore another scenario. Say an FPrime spacecraft downlinks image.bin. Then deletes it, makes a new image.bin and downlinks that. FPrime GDS would do the same thing, it would overwrite the first version of image.bin with the second version if image.bin.

Note that both of these operational scenarios are used all the time. I'm not talking once per mission, I'm talking multiple times per day.

I think FPrime GDS should be modified to ensure received files all have unique names. I've seen them appended with the Earth Received Time (ERT) with great success. It's easy to remove with a simple RegEx and ensures uniqueness.

See also #2458 for a mildly-related issue.

Joshua-Anderson commented 1 month ago

The reason the GDS is currently designed this way is to properly handle partial file downlinks (i.e. Filedownlink.SendPartial). You can do multiple partial downlinks, appending/updating the existing file.

I wouldn't be overly worried about file corruption, since all file packets are checksummed, but if you're overwriting an existing file onboard the spacecraft, combining the files on the ground can definitely lead to confusion.

Since the fprime-gds is primarily for ground testing, I think designing around user friendlyness and appending ERT to the filename of downlinked files makes sense to me. Occasional users of SendPartial can manually append files together.

@thomas-bc What do you think about:

thomas-bc commented 1 month ago

That approach makes sense to me!