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

testing.(*T).TempDir() panics in cleanup #291

Open
RmbRT opened this issue Nov 6, 2024 · 2 comments
Open

testing.(*T).TempDir() panics in cleanup #291

RmbRT opened this issue Nov 6, 2024 · 2 comments

Comments

@RmbRT
Copy link

RmbRT commented Nov 6, 2024

Issue description

In tests, calling t.TempDir() leads to an error during cleanup:

testing.go:1225: TempDir RemoveAll cleanup: unlinkat /tmp/TestExample406597298: bad file descriptor

In enclave.json, /tmp has been mounted as memfs. I also had tried using hostfs and mounting the native tmp directory, and also tried mounting the root directory as hostfs.

It worked when I used tmp, _ := os.MkdirTemp("", "*") instead, maybe that is an acceptable fix? Although once I added a defer os.RemoveAll(tmp), it also returned an error (not a panic, though). I didn't want to investigate any further, but it seems to be either a problem in os.Remove/All in general, or with temp directories in the ego file system. A superficial fix for t.TempDir() would be to simply not insist on success of the cleanup operation in the testing.go vendor file.

To reproduce

Steps to reproduce the behavior:

  1. Create a test.
  2. Insert _ = t.TempDir()
  3. ego-go test -c && ego sign *.test && ego run *.test (adjust the enclave.json as necessary, obviously)

Expected behavior

I would have expected this to not panic.

Additional info

I am using OE_SIMULATION=1, although that should not affect anything IMO. I'm on Ubuntu 24.

@thomasten
Copy link
Member

Thanks for reporting! We can reproduce this and will investigate.

@thomasten
Copy link
Member

This is fixed in master and will be included in the next release.

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

No branches or pull requests

2 participants