-
Notifications
You must be signed in to change notification settings - Fork 198
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
containers.conf: turn all []string
into attributedstring.Slice
#1710
Conversation
@rhatdan PTAL |
Buildah PR: containers/buildah#5103 |
Podman PR: containers/podman#20483 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small comments
pkg/config/config.go
Outdated
@@ -1143,7 +1143,7 @@ func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error) | |||
return exec.LookPath(name) | |||
} | |||
configHint := "To resolve this error, set the helper_binaries_dir key in the `[engine]` section of containers.conf to the directory containing your helper binaries." | |||
if len(c.Engine.HelperBinariesDir) == 0 { | |||
if len(c.Engine.HelperBinariesDir.Values) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this uses Values vs Get()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get()
will never return nil
, so it adds some cost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you added this special handling to Get()? To me this seems to add unnecessary complexity. Returning nil shouldn't hurt or do podman/buildah tests fail becauase of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildah tests failed. I can follow up on that if you want to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it may be safer to let Get()
return a real copy in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with it but as you said it does extra allocations which means worse performance and memory footprint. It won't be noticeable (I assume) so it is not worth to block/argue about it but many small things start adding up at some point. Copying would definitely make it more expensive with the advantage that the API will be much safer with it.
The main issue is that technically callers can bypass that and just use Values
directly so it is impossible to provide a safe API. Ideally go would allow us to keep the fields private but that won't work with the toml Unmarshaller obviously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the very same line of thoughts. To really avoid callers abusing containers.conf, the loading must be made private and then we can add a carefully curated API (as we do in registries.conf).
Needed in Buildah (and potentially Podman later on) where some options must be overridden. Ultimately this should be avoided whenever possible but this is not my goal at the present. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Convenience function for callers. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
The tests are messy and should be turned into table-driven tests but I do not have time at the moment. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Also tag it as omitempty to fix the test. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
They broke after the attributedstring.Slice migrations. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
To improve the code and reduce memory allocations. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Updated, see last commit. Used NewSlice, Get and Set where possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99, vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@rhatdan PTAL |
/lgtm |
Please see the individual commits. No docs changes yet as I want to get this wired into Buildah and Podman first.