Skip to content

Conversation

@wangke19
Copy link
Contributor

@wangke19 wangke19 commented Oct 22, 2025

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:

  1. The Load function returns nil, nil when the config file doesn't exist (expected behavior)
  2. The code was trying to print the config without checking if it was nil first
  3. There was also a potential issue where cfg fields were accessed without nil checks

Solution

  • Added nil check before printing config to prevent panic
  • Added nil check before accessing cfg fields in merge-base logic
  • Gracefully handle missing config file with informative message

Testing

  • Built and tested the fix locally
  • Confirmed the program no longer panics when config file is missing
  • Program now displays "config: (no config file found)" instead of crashing

Changes

  • commitchecker/commitchecker.go: Added nil checks for config handling

Fixes the panic: runtime error: invalid memory address or nil pointer dereference at commitchecker.go:31 when commitchecker.yaml is not present.

- 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.
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 22, 2025

@wangke19: This PR was included in a payload test run from openshift/kubernetes#2475
trigger 0 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

@wangke19
Copy link
Contributor Author

/payload-job-with-prs pull-ci-openshift-build-machinery-go-master-verify-commitchecker openshift/kubernetes#2475

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 22, 2025

@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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 22, 2025

@wangke19: This PR was included in a payload test run from openshift/kubernetes#2475
trigger 0 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 22, 2025

@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.

@jsafrane
Copy link
Contributor

@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 commitchecker verson v0.0.0-unknown-c3556e1, which does not include #109

@jsafrane
Copy link
Contributor

Not sure how to convince CI to refresh the image

@jsafrane
Copy link
Contributor

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.
/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 23, 2025

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 5d77c1a into openshift:master Oct 23, 2025
5 checks passed
@jsafrane
Copy link
Contributor

From some reason a new image with this PR was pushed to the right places in few hours
/shrug

@openshift-ci openshift-ci bot added the ¯\_(ツ)_/¯ ¯\\\_(ツ)_/¯ label Oct 23, 2025
@wangke19 wangke19 deleted the fix-commitchecker-nil-config-panic branch October 28, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ¯\_(ツ)_/¯ ¯\\\_(ツ)_/¯

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants