-
Notifications
You must be signed in to change notification settings - Fork 47
fix: prevent nil pointer dereference when config file is missing #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent nil pointer dereference when config file is missing #110
Conversation
- Add nil check before printing config to prevent panic - Add nil check before accessing cfg fields in merge-base logic - Gracefully handle missing config file with informative message Fixes panic: runtime error: invalid memory address or nil pointer dereference at commitchecker.go:31 when commitchecker.yaml is not present.
|
@wangke19: This PR was included in a payload test run from openshift/kubernetes#2475 |
|
/payload-job-with-prs pull-ci-openshift-build-machinery-go-master-verify-commitchecker openshift/kubernetes#2475 |
|
@wangke19: the repo openshift/build-machinery-go does not contribute to the OpenShift official images, or the base branch is not currently having images promoted |
|
@wangke19: This PR was included in a payload test run from openshift/kubernetes#2475 |
|
@wangke19: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@wangke19 can you please link PR where commitchecker failed? I can see it crashing in one of my PRs https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_aws-ebs-csi-driver/294/pull-ci-openshift-aws-ebs-csi-driver-master-verify-commits/1980993927829786624 But that uses |
|
Not sure how to convince CI to refresh the image |
|
I don't think this PR fixes anything, the null pointer dereference is already fixed. But I am going to merge it to see if a new commitchecker image gets pushed to the right places. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsafrane, wangke19 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
From some reason a new image with this PR was pushed to the right places in few hours |
Fixed by AI Cursor.
Problem
The commitchecker tool was panicking with a nil pointer dereference when the config file (
commitchecker.yaml) was not present. This happened because:Loadfunction returnsnil, nilwhen the config file doesn't exist (expected behavior)cfgfields were accessed without nil checksSolution
Testing
Changes
commitchecker/commitchecker.go: Added nil checks for config handlingFixes the panic:
runtime error: invalid memory address or nil pointer dereferenceatcommitchecker.go:31whencommitchecker.yamlis not present.