Repository navigation
Conversation
A process that appends data to a ULog file (for example PX4's hardfault_log after a crash) stores the file offset where the new data starts in the flag bits message. The log may have been cut in the middle of a message at that offset. The reader reported "File contains appended offsets - this is not supported" and kept parsing through the offset. A cut message was then joined with the appended bytes: on pyulog's sample_appended.ulg this gives one data sample with garbage values, and appended messages after a cut could be lost. Read up to each appended offset separately, drop the cut message and any recovery state there, and continue with the appended data. Offsets that point into the file header are ignored with an error. Assisted-by: Claude:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A process that appends data to a ULog file (for example PX4's
hardfault_logafter a crash) sets theDATA_APPENDEDflag and stores the file offset where the new data starts inappended_offsets. The file may have been cut in the middle of a message at that offset.The reader had a TODO there: it reported "File contains appended offsets - this is not supported" and kept parsing through the offset. A message cut at the offset was then joined with the appended bytes. On pyulog's
test/sample_appended.ulg(a real PX4 log) this gives one extra data sample with garbage values. With a cut message, appended messages can also be lost (in the new test, the appended logging message).Changes
Reader::readChunk()now reads up to each appended offset separately. At the offset it drops the cut message (if any) and any recovery state, and continues with the appended data, which holds Data section messages.readMessages();tryToRecover()calls it instead ofreadChunk().Testing
sample_appended.ulgandsample_appended_multiple.ulg, the data and logged messages now match pyulog's output exactly (before: one extra garbage sample insample_appended.ulg).On
ubuntu:26.04linux/amd64 (GCC 15.2.0, CMake 4.4.5, as on the CI runner):make -C build run-unit-testspasses 10/10 test cases,pre-commit run -apasses, andmake -C build clang-tidypasses with clang-tidy 20.1.8 and 21.1.8. clang-tidy 22.1.2 reports the same 16 findings onmainand on this branch, none in the changed lines.This PR was prepared with AI assistance (Claude).