Skip to content

fix rootless netns cleanup when PID file is empty#931

Open
yoonseo-han wants to merge 1 commit into
podman-container-tools:mainfrom
yoonseo-han:fix/empty-pid-file
Open

fix rootless netns cleanup when PID file is empty#931
yoonseo-han wants to merge 1 commit into
podman-container-tools:mainfrom
yoonseo-han:fix/empty-pid-file

Conversation

@yoonseo-han

Copy link
Copy Markdown

Fixes podman-container-tools/podman#28441

Based on the previous PR #759

When pasta fails to start, it can leave an empty PID file behind. Rootless netns cleanup then tried to parse that file and failed, even though there was no process to clean up.

This change treats an empty or whitespace-only PID file as a no-op during cleanup, while still returning real parse errors. It also uses errors.Join when both the inner operation and cleanup fail, so both errors keep their type information.

Main fixes

  • Add errEmptyPIDFile and return it from readPidFile for empty/whitespace content
  • Handle errEmptyPIDFile in cleanupRootlessNetns without failing cleanup
  • Join inner and cleanup errors with errors.Join instead of fmt.Errorf
  • Add TestReadPidFile unit tests

Treat an empty pasta PID file as a no-op during cleanup, preserve other parse errors, and join cleanup errors with errors.Join. Added unit tests

Signed-off-by: Yoonseo Han <yooncer00@gmail.com>
@github-actions github-actions Bot added the common Related to "common" package label Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IP address following the "--gateway" argument in pasta_options fails to parse

1 participant