Do not load config files in re-exec process#6711
Merged
Luap99 merged 3 commits intocontainers:mainfrom Mar 10, 2026
Merged
Conversation
nalind
reviewed
Mar 9, 2026
Member
nalind
left a comment
There was a problem hiding this comment.
Got some typos in the commit messages ("cotnainers.conf", "signle", "refernce"), otherwise LGTM.
There is one large problem with using init() functions here, they run
every single time the executable is started even in cases where we do
not need the buildah cli. The main point being the reexec logic which
bypasses all of the cli and may be in a totally different rootfs.
Currently the init() function needs containers.conf and storage.conf so
these files gets parsed in wrong contexts doing extra work that is not
required.
For reference I used the following script:
```
for FILE in $(find ./cmd/buildah/ -type f -not -name '*_test.go'); do
BASENAME=$(basename "$FILE")
FILENAME_NO_EXT="${BASENAME%.*}"
sed -i "s/func init() {/func ${FILENAME_NO_EXT}Init() {/g" "$FILE"
echo "${FILENAME_NO_EXT}Init()"
done
```
And then used the output to be added in main() after the reexec call.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
In order to avoid parsing containers.conf inside the reexec child process just resolve it before. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This is a partial revert of commit 04847f5 ("Set CONTAINERS_CONF in the chroot-mount-flags integration test"). With the changes from the prior commits we should not longer load containers.conf in the re-exec processes and as such leaking the env is no longer needed to work around the test issue. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Member
Author
|
Thanks, fixed. |
Member
Author
|
@Honny1 @TomSweeneyRedHat PTAL and merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
What this PR does / why we need it:
It fixes storage.conf parsing errors with my storage.conf rework in #6708
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?