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

Fix getLibpodTmpDir() on Windows #2357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sebsoto
Copy link

@sebsoto sebsoto commented Mar 8, 2025

Changes the function to return an absolute path. Without this, EngineConfig.Validate() will return an error on Windows when using the default values.

Copy link
Contributor

openshift-ci bot commented Mar 8, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebsoto
Once this PR has been reviewed and has the lgtm label, please assign mheon for approval. For more information see the 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

@sebsoto
Copy link
Author

sebsoto commented Mar 8, 2025

Before and after:

image

@Luap99
Copy link
Member

Luap99 commented Mar 10, 2025

Are you trying to port buildah on windows? It would be news to me that buildah can be used on windows.
cc @nalind

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

Practically speaking this is a totally useless path on windows. If this should actually work on windows should this not return an actual standard windows temp dir path instead?

@sebsoto
Copy link
Author

sebsoto commented Mar 10, 2025

Are you trying to port buildah on windows? It would be news to me that buildah can be used on windows.

@Luap99 I have an issue open for that: containers/buildah#4010

This change is just fixing something in a shared library, that is obviously broken, and should probably done regardless of the buildah Windows issue.

Practically speaking this is a totally useless path on windows. If this should actually work on windows should this not return an actual standard windows temp dir path instead?

I don't know the full context as to why this path is being used, but the Linux function returns the same path.

func getLibpodTmpDir() string {
return "/run/libpod"
}

There is also this other function which actually returns a temporary directory.

func getDefaultTmpDir() string {
// first check the Temp env var
// https://answers.microsoft.com/en-us/windows/forum/all/where-is-the-temporary-folder/44a039a5-45ba-48dd-84db-fd700e54fd56
if val, ok := os.LookupEnv("TEMP"); ok {
return val
}
return os.Getenv("LOCALAPPDATA") + "\\Temp"
}

@sebsoto
Copy link
Author

sebsoto commented Mar 10, 2025

@Luap99 I can change the value to be in the temp folder so it actually becomes temporary.

Verified

This commit was signed with the committer’s verified signature.
sebsoto Sebastian Soto
Changes the function to return an absolute path to a temporary
directory. Without this, EngineConfig.Validate() will return an error
on Windows when using the default values, as /run/libpod is not an
absolute directory on Windows.

As C:\run is not a temporary directory on Windows, changes the path to
be within the Temp folder.

Signed-off-by: Sebastian Soto <[email protected]>
@Luap99
Copy link
Member

Luap99 commented Mar 10, 2025

The change itself should be fine BUT

I think it would likely best to start with some high level overview of what you are going to change and how buildah on windows should work. We have very little windows expertise so any actual review will be very difficult us. Thus I am not sure how that would work out.
I am not strictly against it but I think this needs some actual plan first. How is going to do all that work and then also who is maintaining it going forward? (It would be best to keep that discussion on containers/buildah#4010).

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.

None yet

2 participants