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
os: Remove and RemoveAll can't remove the current directory on AIX #32180
Comments
It's a shame that POSIX didn't define that, since as far as I know all other Unix systems do support removing the current directory. I don't think there is anything we can do here. We can't Which tests are leaving behind temporary directories? It looks like the test helper function |
I don't have a precise list at the moment but it doesn't only deal with tests. After running ./all.bash, cgolife and cgostdio are two tests under there are calling |
FYI: this, or something similar to this was also a problem with windows. As far as I know, windows also can't remove a dir with a lock (including CWD). I haven't ran a builder in a while, but you may want to look for some windows specific code. |
As you say, the The |
There is nothing obvious in os/file_windows.go. Maybe this is done on a case-by-case basis.
I've tried but nothing occurred... It seems random once again. I'll update misc/cgo tests but will need to investigate more about those go-build. |
On AIX, unlinkat or rmdir syscall doesn't work on the CWD. Therefore, a program like the following one doesn't remove GOPATH.
There is no real documentation on that. However, rmdir seems to return EBUSY and unlinkat EPERM. So, we should be able to detect if os.Remove is failing because of that. However, what's the correct behavior if we want to fix that ?
Do we chdir to the parentdir ? "/tmp" ? the executable folder ? anything else ?
Or do we want to keep this behavior ?
Note that, when calling os.Removeall, everything except the directory itself is still being removed. Therefore, only a empty directory remains. But, as most of the tests are doing a
defer os.Removeall
, /tmp is filled with empty directories...Do some other OSes have the same problem ?
Edit: POSIX rmdir doesn't specify which behavior must be done (cf https://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html)
The text was updated successfully, but these errors were encountered: