Skip to content

Conversation

@CharityKathure
Copy link

Fixes: #containerd/nerdctl#2485

Windows Containers have a default path already configured at bootup. WithDefaultPathEnv overwrites this with a unix path

@k8s-ci-robot
Copy link

Hi @CharityKathure. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@CharityKathure CharityKathure marked this pull request as draft September 19, 2023 14:49
@CharityKathure CharityKathure marked this pull request as ready for review September 19, 2023 15:55
@dcantah
Copy link
Member

dcantah commented Sep 19, 2023

Please squash the two commits to one. The change LGTM after that and the one comment!

@thaJeztah
Copy link
Member

@dcantah
Copy link
Member

dcantah commented Sep 19, 2023

@thaJeztah yell at em 😆

@thaJeztah
Copy link
Member

thaJeztah commented Sep 19, 2023

😂 I mean, Windows moves in mysterious ways if you're used to Linux. I should look at some canonical docs for that, and link it in the code (for future reference). I think we also may want to update the OCI image / runtime specs to mention this (ISTR it mentions the path to set for Linux)

Any useful info welcome on that matter (feel free to comment on my PR)

@CharityKathure CharityKathure force-pushed the windows-default-path-overwrite-fix branch from 3f04db3 to 321bf97 Compare September 19, 2023 19:24
@dcantah
Copy link
Member

dcantah commented Sep 20, 2023

cc @kevpar @kiashok. AFAIR the OS did set/use a default path so this seems correct. We don't seem to set a default path in some spots that we would for linux either after perusing. https://github.com/microsoft/hcsshim/blob/27df1b95b69faaeca97de86d25d68f48f89bc0b9/internal/cmd/cmd.go#L118-L125

@thaJeztah
Copy link
Member

I referred to John Howard's commit in moby/moby@3c177dc (which called this out moby/moby@3c177dc#diff-4f8b57539bb09b7370a8ebaf4557bdcf65a63f2443edf4e0d42eecfeeacef900R13-R15)

@kiashok
Copy link
Contributor

kiashok commented Sep 26, 2023

@CharityKathure could you add a test for this?

@kiashok
Copy link
Contributor

kiashok commented Sep 26, 2023

cc @kevpar @kiashok. AFAIR the OS did set/use a default path so this seems correct. We don't seem to set a default path in some spots that we would for linux either after perusing. https://github.com/microsoft/hcsshim/blob/27df1b95b69faaeca97de86d25d68f48f89bc0b9/internal/cmd/cmd.go#L118-L125

We could move this function to a new oci/spec_opts_nonwindows.go file if we do not intend it to be used on windows.
I see that in containerd, WithDefaultPathEnv() is only being called from linux specific functions. Should it be the responsibility of the callers to ensure that they do not override the default path for windows? For example. this function seems to be called from a generic call path to create container on nerdctl

oci/spec_opts.go Outdated

// WithDefaultPathEnv sets the $PATH environment variable to the
// default PATH defined in this package.
func WithDefaultPathEnv(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
Copy link
Contributor

@kiashok kiashok Sep 26, 2023

Choose a reason for hiding this comment

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

If this function is not intended to be used on windows, we should probably move this out to a new spec_opts_nonwindows.go file and override this function to return nil/unsupported in spec_opts_windows.go

@CharityKathure CharityKathure force-pushed the windows-default-path-overwrite-fix branch 2 times, most recently from 98e56fe to 5ec0a26 Compare October 4, 2023 13:27
Windows Containers have a default path already configured at bootup. WithDefaultPathEnv overwrites this with a unix path

Signed-off-by: charitykathure <kathurecharity505@gmail.com>
@CharityKathure CharityKathure force-pushed the windows-default-path-overwrite-fix branch from 5ec0a26 to 13dcf55 Compare October 4, 2023 20:14
Charity Kathure added 2 commits October 5, 2023 10:09
Windows Containers have a default path already configured at bootup. WithDefaultPathEnv overwrites this with a unix path

Signed-off-by: charitykathure <kathurecharity505@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants