Skip to content

Fix: address multiple minor bugs found during code audit#492

Open
vinayakjeet wants to merge 1 commit intourunc-dev:mainfrom
vinayakjeet:fix/audit-bugs
Open

Fix: address multiple minor bugs found during code audit#492
vinayakjeet wants to merge 1 commit intourunc-dev:mainfrom
vinayakjeet:fix/audit-bugs

Conversation

@vinayakjeet
Copy link
Contributor

@vinayakjeet vinayakjeet commented Feb 17, 2026

Description

Refactor error handling and nil-safety: use annotHypervisor in isRunning, remove nil error wrapping, fix consoleFile nil-deref, use errors.Is for sentinel checks, and propagate errors from getInitPid and deleteAllTCFilters.

Related issues

None

How was this tested?

lint and build

LLM usage

None

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

- Use annotHypervisor instead of annotType in isRunning()

- Remove nil error wrapping in run.go

- Fix potential nil-deref on consoleFile in rootfs.go

- Use errors.Is() for sentinel error comparison

- Propagate errors in getInitPid instead of swallowing

- Propagate error in deleteAllTCFilters

Signed-off-by: vinayakjeet <vinayakjeetog@gmail.com>
@netlify
Copy link

netlify bot commented Feb 17, 2026

Deploy Preview for urunc ready!

Name Link
🔨 Latest commit ca7884f
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/699482535786250008ab6ddc
😎 Deploy Preview https://deploy-preview-492--urunc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vinayakjeet
Copy link
Contributor Author

hi @cmainas can you please review the changes .

@vinayakjeet vinayakjeet changed the title Fix: address multiple bugs found during code audit Fix: address multiple minor bugs found during code audit Feb 17, 2026
Copy link
Contributor

@IrvingMg IrvingMg left a comment

Choose a reason for hiding this comment

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

Some changes need to be reviewed, as they’re breaking unit tests and may not be actual bugs. You can run make unittest to verify that they pass.

file, err := os.Open(filePath)
if err != nil {
return 0, nil
return 0, fmt.Errorf("failed to open %s: %w", filePath, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

I’m not sure this is actually a bug. This change is breaking the test case "init PID file not found," which suggests that nil is the expected return value.

Could you please verify?

if err := decoder.Decode(&jsonData); err != nil {
return 0, nil

return 0, fmt.Errorf("failed to decode JSON from %s: %w", filePath, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. This breaks test "init PID invalid JSON". Please verify.

return err
}
return fmt.Errorf("urunc run failed: %w", nil)
return fmt.Errorf("urunc run is not supported")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we returning "urunc run is not supported"?

I don't know why we’re always returning an error here, but it looks like it should be nil instead of an "unsupported" error. Could you please double-check?

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