kernel: Filesystem 'casefold' support
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
### **Is your feature request related to a problem? Please describe.**
It would be extremely useful if the WSL2 kernel supported 'casefold', as that can be used for example when building windows code inside an WSL2 instance.
See https://www.collabora.com/news-and-blog/blog/2020/08/27/using-the-linux-kernel-case-insensitive-feature-in-ext4/ For reference on the feature (blog post by the author of the feature).
To build such code, often this feature is desirable because the names referred to on '#include' can have different casing than the names on the filesystem itself.
### **Describe the solution you'd like**
Here is an incremental plan to support it at different levels:
1) Currently 'casefold' filesystem feature is disabled on the WSL2 kernel because `CONFIG_UNICODE` is not set, so we need to just enable it.
2a) The root ext4 filesystem can be created with 'casefold' feature enabled (ie `mkfs.ext4 -O casefold`).
2b) The host windows filesystem mounted into WSL2 can expose the 'casefold` attribute. This could be support for just reading this attribute, or also setting as well depending on support from the underlying filesystem.
I have tested an implementation of `1)` by building a custom kernel, and no issues seen so far.
`1)` and `2a)` seem fairly trivial to support. `2a)` Introduces some risk in that the filesystem then cannot be mounted on kernels without the feature. And once the feature is actually used on filesystem (ie a directory with `+F` attribute is first set), the feature cannot be turned off anymore (such as with using `tune2fs -O ^casefold`).
`2b)` depends on WSL2 exposing attributes at all for host filesystem, which currently does not seem to be implemented.
### **Describe alternatives you've considered**
* Using the host windows filesystem, but this has much worse performance and usability.
* Applying workarounds to the file tree (such as creating symlinks or patching the files so casing is consistent), but this has even poorer usability, takes more effort and is more error prone.
Contributor guide
Research direction
Start by locating the WSL2 kernel configuration and the setting for CONFIG_UNICODE. Verify whether enabling it permits an ext4 filesystem created with mkfs.ext4 -O casefold to be mounted and used. Treat exposing casefold attributes for the host Windows filesystem as a separate follow-up, since the issue says that support may not exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100