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

Add possibility to override /tmp #2345

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

afbjorklund
Copy link
Contributor

@afbjorklund afbjorklund commented May 13, 2024

Use $TMPDIR to change the location of /tmp on Unix.

Use $TEMP to change the location of /tmp on Windows.

https://pkg.go.dev/os#TempDir

Closes #2339

@afbjorklund
Copy link
Contributor Author

afbjorklund commented May 13, 2024

On second thought, having /var/tmp/lima mount under /tmp/lima breaks the abstraction.

We probably still need to do something different on Windows, and not use localpathutil?

No idea where C:\Users\UserName\AppData\Local\Temp\lima is supposed to end up.

Possibly something like /c/Users/UserName/AppData/Local/Temp/lima, maybe /mnt

Use `$TMPDIR` to change the location of `/tmp` on Unix.
Use `$TEMP` to change the location of `/tmp` on Windows.

Signed-off-by: Anders F Björklund <[email protected]>
Output the temporary directory in the `limactl info`.
It is possible to use the utility `cygpath` on Windows.

Signed-off-by: Anders F Björklund <[email protected]>
@afbjorklund
Copy link
Contributor Author

afbjorklund commented May 14, 2024

Now the location is the same as the mountpoint, so the illusion holds.

i.e. you can still do something like lima /tmp/lima/foo with any temp dir

Reference to the cygpath utility, regarding DOS filepath translation...

https://www.msys2.org/docs/filesystem-paths/ (skipped the /mnt)

@jandubois
Copy link
Member

No idea where C:\Users\UserName\AppData\Local\Temp\lima is supposed to end up.

Possibly something like /c/Users/UserName/AppData/Local/Temp/lima, maybe /mnt

I have not really used Lima on Windows yet, but aren't we using WSL2 for the emulation? In that case we should be using WSL2 path names and not msys hacks.

Note that with WSL2 (depending on how it is configured) none of our mounting really matters as everything is already mounted anyways:

suse@rd-w11-test-1:~$ wslpath -u c:\\user
/mnt/c/user
suse@rd-w11-test-1:~$ wslpath -w /tmp
\\wsl.localhost\Ubuntu-22.04\tmp

@afbjorklund
Copy link
Contributor Author

afbjorklund commented May 14, 2024

This was having the eye towards QEMU (or Hyper-V perhaps), but mostly it was just a (new) unit test failure...

assertion failed: error is not nil: field `mounts[1].location` must be an absolute path, got "/tmp/lima"

As you mention I think WSL comes with (9p) mounts already.

But it doesn't run custom kernels or custom cloud images.

@afbjorklund
Copy link
Contributor Author

Then again, this feature is really on needed on Fedora or on Windows (i.e. without WSL)

It is not needed on Ubuntu or on macOS, so I think I will just leave it in "draft" for a while

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.

Add abstraction for the default /tmp/lima directory ?
2 participants