/ go Public
os: Remove and RemoveAll can't remove the current directory on AIX #32180
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
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: