Skip to content

fix: report profile creation errors without panicking - #98

Open
dajiaohuang wants to merge 1 commit into
alegrey91:mainfrom
dajiaohuang:fix/profile-save-error
Open

dajiaohuang wants to merge 1 commit into
alegrey91:mainfrom
dajiaohuang:fix/profile-save-error

Conversation

@dajiaohuang

Copy link
Copy Markdown

When harpoon build --save --name missing/seccomp.json cannot create the output file, the error handler calls Name() on the nil file returned by os.Create and panics. Use the requested profile name in the error so callers receive the wrapped filesystem error. Add a regression for a nonexistent output parent.

Validation: the regression panics against the original cmd/build.go and passes against the fixed file, using a temporary source-file harness with only a Cobra root binding to avoid initializing tracing commands. Safe unit packages (internal/archiver, internal/elfreader, internal/seccomputils, internal/syscallutils; analyzer has no tests) and git diff --check pass. Full command-package/build and privileged integration tests were not run: this environment's scope excludes loading eBPF, elevation and real-process tracing. Only synthetic temporary files were used.

This branch has not been deployed

No deployments
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.

1 participant