-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: fails when main module is in a 9P network share on Windows Subsystem for Linux #37461
Comments
Thanks for the report. The Windows Subsystem for Linux is not a supported platform. The fact that it accidentally worked on Go1.13 does not necessarily mean that it will keep working going forward. We don't have a builder (since it's not a supported platform), so breakage may happen. I'm closing this issue, but please feel free to comment if you can reproduce this on plain Windows or on Linux; and we'll re-open. |
Can the support of WSL2 be considered or included into roadmap? WSL2 is becoming a popular platform as it soothes many pains of development under Windows. |
@artsafin See https://golang.org/wiki/PortingPolicy . That said, I thought the goal of WSL was to permit running GNU/Linux programs on Windows. It ought to work to run |
The problem here is when your code lives within the WSL2 VM, but you're working on it via the \wsl$ network share in your IDE / toolchain. A lot of us have adopted this since it allows us to code in Windows, but do all testing / verification in Linux. The go binary fails to lock the needed |
It's just that it's not happening with go 1.13, it would be nice to be able to disable the rlock feature |
Another one here with the same problem. This issue makes working in Goland a chore... Each time I add a library to the project I have to copy the project to the Windows drive and download modules there... The issue is not about WSL2 itself, but about Go being able to work on Windows with files on the share via P9 protocol. |
It's possible to workaround the issue by launching IDE inside WSL connecting it to X server installed on Windows host. However native support of working on network shares would be much appreciated. |
Many more people are in need of this. Having an option to disable the file locking would make it work |
Some file systems do not support file locking. Ignore lock errors in these environments. I used the already implemented IsNotSupported function. If the file system does not support locking on Windows, ERROR_INVALID_FUNCTION is returned. Edited isNotSupported to ignore this. References golang#37461
Change https://golang.org/cl/275392 mentions this issue: |
As it just so happens, we now have a WSL builder thanks to @mengzhuo (#17365 (comment)), so I think we can reopen this issue. |
(That said, the |
Note that the 9P protocol does support file-locking — So it seems that the root problem here is that the Windows filesystem APIs are incomplete for the 9P filesystem, for which @kamijin-fanta has helpfully filed microsoft/WSL#5762. |
The We had originally only used file locks in the module cache, instead preferring atomic renames for the |
Is there a way to get involved in setting this up? I do have the time for it, but I don't know how to contribute to this. |
Honestly, this seems like a niche enough use-case that I would be satisfied with a test that only fails locally. (This particular part of That said, since this is an upstream bug (an implementation deficiency in the WSL2 filesystem) and there is what seems like a straightforward workaround in the interim (use a working directory and |
I also do think that adding more complexity than needed is not a good thing. However, PR #42994 seems a good way to deal with this issue (and others) when locking is not available (for some reason). Once (IF!) wsl2 implements plan9 locking correctly, no need for any changes would be needed, and we would be safe for other types of file-systems that will be thrown in the wsl (or other system) pool that we do not know of. |
We already should not require any changes once the Windows 9P implementation supports
Given that ignoring file-locking errors can lead to silent corruption of the affected files, “safe” is definitely not the word I would use. 😒 |
Please tell me, where can I find the test code for plan9? I thought it wasn't working properly in plan9. |
@kamijin-fanta, the tests in There is an additional integration test in |
(The last Plan 9 file-locking bug I'm aware of was #38719, which we fixed by using |
Thanks to you, I understand that Plan 9 implements a lock that doesn't use filelock.Lock here. If the file system does not support locking, can it be implemented using lock files? Create a lock file in the TMP directory, etc. to control the lock. I'm thinking of implementing apt like /var/lib/apt/lists/lock. But this is an ad hoc fix for only WSL. |
Hi!
How can I resolve it? |
I am now having this problem too: using github.com/u-root/cpu, i.e. a 9P2000 mount on Linux, and the gvisor 9P package, which does not support Tlock. While the use of flock may be fine on a local file system, depending on file locks to work on any network file system has always been a hazardous undertaking; even the most simple search for rpc.lockd bugs is revealing. I think Go is being a bit optimistic here about how effective an flock is. I'd suggest that the build command continue if the error is "not implemented." There is little else that can be done in that case, and it is seems sensible to me to, at most, print a warning, but not actually exit with a fatal error. It may not be possible for people to swap out their kernel or their network file system protocol. I'm happy to submit a PR if that is acceptable. |
Ah somebody beat me to it, I'll take a look at that PR. Again, the situation in my case is a small IoT running Go, over 9P2000. The 9P2000 Go package I'm using does not have Tlock support atm, and it is literally a single user situation, in the IoT case. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It is the last release
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm using Windows Subsystem for Linux 2 and I access my files using a network driver. I tried to use
go mod init
in a new project and got this error :(Fonction incorrecte means incorrect/invalid function)
Then i tried to create it by end with the content :
Running
go list -m
(or any command requiring this file actually) gives me this error :go: RLock Z:\home\a\go\graph\go.mod: Fonction incorrecte.
What did you expect to see?
my go.mod file created.
What did you see instead?
An error about Lock/RLock.
More information:
After reinstalling go 1.13.8, i had everything working back.
The text was updated successfully, but these errors were encountered: