Open kamijin-fanta opened 4 years ago
Read this: https://devblogs.microsoft.com/commandline/a-deep-dive-into-how-wsl-allows-windows-to-access-linux-files/ and this https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/. Basically this means WSL2 will be unable to support without support being added to the 9P file server (unlikely).
There's a comment in the golang/go repo that suggests that the 9P protocol does support file-locking, but the implementation used in WSL does not.
Can someone on the WSL team confirm this is the case? If so, can we have any insight into whether or not this will be fixed at some point? @craigloewen-msft @benhillis
@benhillis @craigloewen-msft Can we get some feedback on this please?
I haven't seen any other MS employees active in these issues, so I'm pinging you two. If there's someone else that should be involved in this discussion, please let us know.
This also affects Gradle (a JVM build system).
This apparently also affects any programs on Windows which try to use SQLite to open a database on the WSL side (for instance, an ext4 partition mounted using wsl --mount
). I can easily reproduce this by creating a simple test database in WSL, then running sqlite3.exe to open it, and execute the SQL statement SELECT * FROM SQLITE_MASTER
- this produces this error:
Parse error: database is locked (5)
\wsl$ also doesn't support watch
. Why doesn't WSL use SMB? I set up samba in WSL, it supports both file locking and watch.
I ended up dropping the shit \wsl$, replacing it with SMB
Is your feature request related to a problem? Please describe.
Package management tools such as Go Modules and Rust Cargo use Write/Read Lock of File System. This is an important mechanism for removing conflicts.
The WSL2 shared directory
\\wsl$
does not seem to support LockFileEx syscall. I confirmed that smb supports it. It returns anIncorrect function.
error with theLOCKFILE_EXCLUSIVE_LOCK
flag both set/unset.To solve this problem, Rust Cargo has added code that ignores lock errors. https://github.com/rust-lang/cargo/pull/7602 Go Modules does not work with WSL and officially replied to Issue that WSL is not supported. https://github.com/golang/go/issues/37461
Describe the solution you'd like Add locking functionality to the shared file system for a better development experience.
Describe alternatives you've considered
Additional context
Below is an example of an error with go modules in latest version.
simple test code to call LockFileEx