-
Notifications
You must be signed in to change notification settings - Fork 10
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
is case-insensitive the default now with 0.6.0? #48
Comments
There has been no (expected!) change regarding casing in version
If you were previously experimenting on a Unix platform, then that likely explains the difference in behavior. From the README:
This is the one example of platform-specific behavior in glob expressions. It behaves a bit more intuitively and also means that literals are invariant by default. For example, on Windows the expression Windows paths may be resolved in a case-sensitive manner, but I think this is much less common and I believe it requires using prefixed paths (with suitable APIs) or using low level interfaces (the file system has no notion of casing). |
Thanks for your answers. I think you're right that I was checking Windows one day and Linux/MacOS on another. Any windows folder can be configured to be case sensitive like this below, but I wouldn't recommend anyone really do it. It's cool to play around with one folder but if one was to do their entire drive this way, things would probably stop working.
or recursively like this from powershell.
For our use case in nushell, I'd prefer consistency over platform specific behavior. It just helps with script portability. I'm just not sure how to code around this now to have similar behavior on Mac/Linux/Windows. In my example today, I was doing |
Oof, I wasn't aware of this. Thanks for bringing it to my attention! It looks like this was added in Windows 10 Build 17093 back in 2018 for WSL. This means that textual variance on Windows can only be determined semantically with respect to a path and the attributes of all directory components in that path. And it is per-component. Brutal. Said another way, there is no reliable notion of a logical pattern match on Windows. (I believe this was technically already the case prior to 17093, but I think these file attributes are both more likely to matter and can actually be handled, unlike choices about which Windows file system APIs to standardize on.) I think this means that to properly support Windows and platforms like it,
I think this applies to globs in I have a lot of thoughts right now on poor interactions between case sensitivity (and these file attributes), semantic literals, and partitioning that I haven't mentioned here yet. I'll mention briefly though that I think recommending partitioning to semantically interpret components like |
Thanks @olson-sean-k for the conversation and willingness to listen to me whine about things. 😆 Each time I respond here, I have to do a dozen web searches to see if what I'm remembering is actually true or something I'm making up. LOL. I think your 17093 link is right but it looks to me like the issue goes back to Windows 95. I believe with Windows 95 Microsoft chose to make the file system Of course, no one runs Windows 95 anymore, but I'd be willing to bet that this "case preserving" functionality is still in Windows 11. I'm anxious to see what comes of this. Let me know if you need us to test something that you come up with. |
It seems like case sensitivity has changed between 0.5.0 and 0.6.0. I'm fairly confident that before in nushell, using our
glob
command that useswax
globbing, we could doglob "c*"
and get only the lowercasec
matches, but now we get all upper and lower case matches. In fact, I have a special example in the glob command's help text that shows how to make a case-insensitive match by doingglob '(?i)c*'
. Just wondering if I missed some updates that explain this or if this is a bug. Thanks!I'm testing on windows, if that's helpful. It looks like case-sensitivity may be turned off for windows paths. I'm wondering if that's the issue. BTW - Windows can have case-sensitive paths but it's pretty rare.
The text was updated successfully, but these errors were encountered: