Skip to content

fix: correct UID/GID mapping buffer offset for multi-line mappings#2075

Merged
giuseppe merged 1 commit intocontainers:mainfrom
giuseppe:fix-multiple-uid-gid-mappings
Apr 24, 2026
Merged

fix: correct UID/GID mapping buffer offset for multi-line mappings#2075
giuseppe merged 1 commit intocontainers:mainfrom
giuseppe:fix-multiple-uid-gid-mappings

Conversation

@giuseppe
Copy link
Copy Markdown
Member

format_default_id_mapping() had 'written += written' instead of 'written += ret' causing the buffer offset to stay at 0 when container_id > 0. This overwrites the first mapping line.

format_default_id_mapping() had 'written += written' instead of
'written += ret' causing the buffer offset to stay at 0 when
container_id > 0.  This overwrites the first mapping line.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@packit-as-a-service
Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

1 similar comment
@packit-as-a-service
Copy link
Copy Markdown

Ephemeral COPR build failed. @containers/packit-build please check.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a bug in the format_default_id_mapping function within src/libcrun/utils.c where the written byte count was incorrectly doubled instead of being incremented by the number of bytes actually written. To verify the fix and prevent regressions, a new test case test_format_default_id_mapping has been added to the test suite, and the total test counts have been updated accordingly. I have no feedback to provide.

@packit-as-a-service
Copy link
Copy Markdown

TMT tests failed. @containers/packit-build please check.

@giuseppe
Copy link
Copy Markdown
Member Author

@jnovy PTAL

@jnovy
Copy link
Copy Markdown
Contributor

jnovy commented Apr 24, 2026

Nice catch of the written += written; thinko

LGTM

@giuseppe giuseppe merged commit dcd0f40 into containers:main Apr 24, 2026
48 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.

2 participants