AP_HAL_SITL: find dumpstack.sh when not run from the repo root - #34076
Open
peterbarker wants to merge 1 commit into
Open
AP_HAL_SITL: find dumpstack.sh when not run from the repo root#34076peterbarker wants to merge 1 commit into
peterbarker wants to merge 1 commit into
Conversation
run_command_on_ownpid() looks for dumpstack.sh and dumpcore.sh relative to the working directory. A serial autotest run works because it runs in the repo root, but under --parallel each instance runs in its own directory, every lookup misses, and we fall back to trusting PATH - where the script is not. A panic there produced "Failed" and no backtrace at all, which is precisely when one is wanted. The AP_SCRIPTS_DIR_PATH override already existed, but the filepath was formed into a 60-byte buffer. An absolute path to a checkout overflows that easily - /home/user/rc/ardupilot-claude2/Tools/scripts/dumpstack.sh is 61 characters - and snprintf simply truncated, leaving a name which failed to stat, so the override looked as though it had been ignored. Size the buffer for a path, and skip any candidate which does not fit rather than stat'ing a truncated name. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Summary
Use AP_SCRIPTS_DIR_PATH (if set) to find dumpstack and dumpcore
Classification & Testing (check all that apply and add your own)
Description
run_command_on_ownpid() looks for dumpstack.sh and dumpcore.sh relative to the working directory. A serial autotest run works because it runs in the repo root, but under --parallel each instance runs in its own directory, every lookup misses, and we fall back to trusting PATH - where the script is not. A panic there produced "Failed" and no backtrace at all, which is precisely when one is wanted.
The AP_SCRIPTS_DIR_PATH override already existed, but the filepath was formed into a 60-byte buffer. An absolute path to a checkout overflows that easily - /home/user/rc/ardupilot-claude2/Tools/scripts/dumpstack.sh is 61 characters - and snprintf simply truncated, leaving a name which failed to stat, so the override looked as though it had been ignored.
Size the buffer for a path, and skip any candidate which does not fit rather than stat'ing a truncated name.