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

os: RemoveAll doesn't work on Plan 9? #9990

Closed
bradfitz opened this issue Feb 25, 2015 · 3 comments
Closed

os: RemoveAll doesn't work on Plan 9? #9990

bradfitz opened this issue Feb 25, 2015 · 3 comments

Comments

@bradfitz
Copy link
Contributor

The "gomote rm" command just runs os.RemoveAll. But I had to run it several times before it completed without error.

Is deleting a file async on Plan 9? If so, that's not Go semantics.

$ gomote create plan9-386-gcepartial
$ gomote puttar -gorev=883bc6ed0ea8 plan9-386-gcepartial
$ gomote run plan9-386-gcepartial src/make.rc
$ gomote rm plan9-386-gcepartial doc api misc test
Error running rm: 500 Internal Server Error; body: remove /tmp/buildlet-scatch798455816/test/fixedbugs: directory not empty

$ gomote rm plan9-386-gcepartial doc api misc test
Error running rm: 500 Internal Server Error; body: remove /tmp/buildlet-scatch798455816/test/fixedbugs: directory not empty

$ gomote rm plan9-386-gcepartial doc api misc test
Error running rm: 500 Internal Server Error; body: remove /tmp/buildlet-scatch798455816/test/fixedbugs: directory not empty

$ gomote rm plan9-386-gcepartial test
$ gomote rm plan9-386-gcepartial doc api misc test
@0intro
Copy link
Member

0intro commented Feb 25, 2015

Is deleting a file async on Plan 9? If so, that's not Go semantics.

No, the system calls are all synchronous on Plan 9.

This issue is related to ramfs. It doesn't happen on Fossil.

Like Fossil, the ramfs file server can return a "directory not empty" error,
when removing a non-empty directory.

https://github.com/0intro/plan9/blob/c0f3d9/sys/src/cmd/ramfs.c#L601

However, RemoveAll, like the rm tool on Plan 9, always removes the
content of a directory before removing the directory itself.

https://github.com/0intro/plan9/blob/c0f3d9/sys/src/cmd/rm.c#L21
https://github.com/golang/go/blob/1eea5c/src/os/path.go#L66

I suppose there is some subtle difference between Fossil and ramfs
and between RemoveAll and rmdir() on Plan 9.

@bradfitz
Copy link
Contributor Author

Well, if plan9's filesystems are inconsistent, I think the Go os package should have workarounds for popular filesystems (like ramfs) and do the Go-like behavior and have os.RemoveAll actually work, doing whatever extra work is required to make Plan 9 happy.

@0intro
Copy link
Member

0intro commented Nov 13, 2017

This issue has been fixed in CL 75974 (closed issue #22572).

@0intro 0intro closed this as completed Nov 13, 2017
@golang golang locked and limited conversation to collaborators Nov 13, 2018
@rsc rsc unassigned 0intro Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants