Skip to content

Fix: generate specs for pod with no infra container#28386

Merged
mheon merged 1 commit into
podman-container-tools:mainfrom
NabilHouidi:fix/generate-spec/segfault
Apr 23, 2026
Merged

Fix: generate specs for pod with no infra container#28386
mheon merged 1 commit into
podman-container-tools:mainfrom
NabilHouidi:fix/generate-spec/segfault

Conversation

@NabilHouidi

Copy link
Copy Markdown
Contributor

This commit fixes #21609.

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?


@NabilHouidi

Copy link
Copy Markdown
Contributor Author

Accidentally signed it with wrong key. I will resign the correct one later

Comment thread pkg/specgen/generate/pod_create.go Outdated

infraSpec := &specgen.SpecGenerator{}
if pod.HasInfraContainer() {
if len(spec.InfraContainerSpec.Image) > 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CI catch: panic: runtime error: invalid memory address or nil pointer dereference

}
}

spec.InfraContainerSpec = infraSpec

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here is spec.InfraContainerSpec set. I assume it is before it is nil.

@NabilHouidi NabilHouidi force-pushed the fix/generate-spec/segfault branch 2 times, most recently from 90ab113 to 2e0b0e3 Compare March 30, 2026 22:06
@NabilHouidi NabilHouidi force-pushed the fix/generate-spec/segfault branch 2 times, most recently from 09f4057 to d2807ea Compare April 18, 2026 15:08
Comment thread pkg/specgen/generate/pod_create.go Outdated
Comment on lines +352 to +355
if len(spec.InfraContainerSpec.Image) > 0 {
spec.InfraImage = spec.InfraContainerSpec.Image
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

non-blocking nit: but this might read better after the unmarshal block below; currently it's wedged in between a logical set.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed now, thanks for the feedback

danishprakash
danishprakash approved these changes Apr 21, 2026

@Honny1 Honny1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, please squosh commits.

@NabilHouidi NabilHouidi force-pushed the fix/generate-spec/segfault branch 2 times, most recently from efa8810 to b958f55 Compare April 21, 2026 21:41
@packit-as-a-service

Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@packit-as-a-service

Copy link
Copy Markdown

tmt tests failed for commit b958f55. @lsm5, @psss, @thrix please check.

@NabilHouidi

Copy link
Copy Markdown
Contributor Author

CI is failing because quay.io is down at the moment. I will retry later.

…ToSpec

fixes podman-container-tools#21609

Signed-off-by: Nabil Houidi <35373676+NabilHouidi@users.noreply.github.com>
@NabilHouidi NabilHouidi force-pushed the fix/generate-spec/segfault branch from b958f55 to d446555 Compare April 22, 2026 21:47
@packit-as-a-service

Copy link
Copy Markdown

tmt tests failed for commit d446555. @lsm5, @psss, @thrix please check.

@Honny1 Honny1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

PTAL @containers/podman-maintainers

@giuseppe giuseppe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mheon

mheon commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Had to check that --share=none actually doesn't create an infra container - wasn't expecting that.

LGTM

@mheon mheon merged commit f384cc5 into podman-container-tools:main Apr 23, 2026
82 of 83 checks passed
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.

podman generate spec segfaults for pod without infra container

5 participants