Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default: look up init binary in helper_binaries_dir #1115

Closed
wants to merge 1 commit into from

Conversation

Foxboron
Copy link
Contributor

@Foxboron Foxboron commented Aug 7, 2022

Some Linux distributions does not install files into /usr/libexec and
would fail to lookup the init binary.

This change first checks if the file exists in the default location,
else we look for the binary in helper_binaries_dir as they should
encompass all the possible installation directories.

Fixes #1110

Signed-off-by: Morten Linderud morten@linderud.pw

Some Linux distributions does not install files into `/usr/libexec` and
would fail to lookup the init binary.

This change first checks if the file exists in the default location,
else we look for the binary in helper_binaries_dir as they should
encompass all the possible installation directories.

Fixes containers#1110

Signed-off-by: Morten Linderud <morten@linderud.pw>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 7, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Foxboron
Once this PR has been reviewed and has the lgtm label, please assign vrothberg for approval by writing /assign @vrothberg in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Thanks for contributing, @Foxboron!

@containers/podman-maintainers PTAL

if _, err := os.Stat(DefaultInitPath); err == nil {
return DefaultInitPath
}
for _, dir := range c.HelperBinariesDir {
Copy link
Member

Choose a reason for hiding this comment

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

Can we use FindHelperBinary() instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, missed that function. Yes we can use it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, this is a bit complicated without some slight refactoring I think.

We pick the init binary in EngineConfig, but there is no Config struct in scope for us to access FindHelperBinary. We could refactor FindHelperBinary to be below EngineConfig, as we only have two uses of them to find the network binaries, and they have access to both structs.

Else we keep the code as-is. Opinions?

Is there something I don't see here?

Copy link
Member

Choose a reason for hiding this comment

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

We can take a step back.

Why not create a public function InitPath() (string, error) that can be called by Podman? The logic would be similar to the current function but all data should be accessible at that point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would need to be InitPath(conf *config.Config) (string, error) right? You still want it to use the FindHelperBinary code from what I can tell.

Copy link
Member

Choose a reason for hiding this comment

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

@containers/podman-maintainers PTAL

Copy link
Member

Choose a reason for hiding this comment

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

@vrothberg the PR does not look like it has your suggested change?

Copy link
Member

Choose a reason for hiding this comment

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

@vrothberg Reminder...

Copy link
Member

Choose a reason for hiding this comment

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

Yes, needs change but I was looking for other opinions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't gotten around to taking a stab at the last suggestions sadly :/ I haven't forgotten about it, just need to find a little bit of time.

@rhatdan
Copy link
Member

rhatdan commented Oct 13, 2022

@Foxboron @vrothberg What do you want to do with this one?

@unknowndevQwQ
Copy link
Contributor

I'm not quite sure if this is the right idea, this pr seems like it would make it difficult for podman to use other container init

@rhatdan
Copy link
Member

rhatdan commented Nov 5, 2023

Closing due to lack of followup.

@rhatdan rhatdan closed this Nov 5, 2023
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 does not adhere to path set with LIBEXECDIR (e.g. for catatonit)
4 participants