Skip to content

stcrashreceiver: fix source loader path detection#10729

Open
mattn wants to merge 1 commit into
syncthing:mainfrom
mattn:fix/source-loader-prefix-detection
Open

stcrashreceiver: fix source loader path detection#10729
mattn wants to merge 1 commit into
syncthing:mainfrom
mattn:fix/source-loader-prefix-detection

Conversation

@mattn
Copy link
Copy Markdown
Contributor

@mattn mattn commented Jun 3, 2026

The crash receiver's source loader only recognized /lib/ and /cmd/, so /internal/ frames (e.g. internal/db/sqlite/...) were never fetched. This adds /internal/, and fixes the "no prefix matched" guard by initializing the index to -1 instead of 0, so unrelated paths are skipped instead of treated as a match at offset 0. Adds tests for both cases.

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
@mattn mattn force-pushed the fix/source-loader-prefix-detection branch from c00f4da to b8316bb Compare June 3, 2026 13:10
Comment on lines +69 to +70
knownPrefixes := []string{"/lib/", "/cmd/", "/internal/"}
idx := -1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal addition is good, -1 assignment unnecessary and obfuscates what happens later, imho :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants