Skip to content

Conversation

SquallATF
Copy link

When /proc/sys/fs/binfmt_misc is not mounted, filepath.WalkDir may pass a nil DirEntry. This caused podman info to panic. Add a nil check to avoid dereferencing it.

Does this PR introduce a user-facing change?

None

Comment on lines 33 to 35
if d == nil {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

That does not seem quite right logically, WalkDir() does not pass path, nil, nil if the dir doesn't exist. It passes path, nil, ErrNotExist. So the bug is actually on the lines above. We should not ignore ErrNotExist but rather handle gracefully and return nil.

if err != nil {
    if errors.Is(err, os.ErrNotExist) {
        return nil
    }
    return err
}

When `/proc/sys/fs/binfmt_misc` is not mounted, filepath.WalkDir may pass a nil DirEntry. This caused podman info to panic. Add a nil check to avoid dereferencing it.

Signed-off-by: Peiyuan Song <[email protected]>
@Luap99 Luap99 added the No New Tests Allow PR to proceed without adding regression tests label Sep 9, 2025
@Luap99
Copy link
Member

Luap99 commented Sep 9, 2025

Can you update your commit message as well as this is not the case and you now do the right error handling.

@mheon
Copy link
Member

mheon commented Sep 9, 2025

/approve
LGTM

Copy link
Contributor

openshift-ci bot commented Sep 9, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon, SquallATF

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 Sep 9, 2025
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. No New Tests Allow PR to proceed without adding regression tests release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants