User: Password:
Subscribe / Log in / New account

The kernel and character set encodings

The kernel and character set encodings

Posted Feb 20, 2004 22:37 UTC (Fri) by spitzak (guest, #4593)
Parent article: The kernel and character set encodings

Could somebody explain why the case-insensitivity is so important, even
for Samba? It seems to me there cannot be too many Windows programs that
take a filename provided to it by the system and change the case before
using it. My tests show that when you double-click files in Explorer or
from the file chooser or any other way I found to select the files,
Windows gave my program the filename with the exact same case as it was
reported in the file listing.

Yes users can type in the wrong case into a shell, but aren't
command-line interfaces supposed to be "unfriendly"? Why does anybody
care if user-unfriendly interfaces work for stupid users or not?

(Log in to post comments)

The kernel and character set encodings

Posted Feb 21, 2004 21:14 UTC (Sat) by fiberbit (subscriber, #693) [Link]

The problem lies in the checking whether or not a file with a given name (case insensitive) exists. Say you do an 'fp = fopen("filename", "a"), and "filename" doesn't exist yet, then in the case-insensitive case, you have to check whether "Filename" or "fIlename" or any other variant *does* exist.
You'd either have to try all possible combinations, or (in practice) scan the whole directory to see if any name matches (and use the first). This not only is very time consuming, but also racy in a multi process environment.
It could be solved by using case-insensitive hash functions in the dentry cache, but that would negatively impact normal filesystems, and is unacceptable to most, including the top penguin.

Re-mount Through Caseless VFS?

Posted Feb 23, 2004 0:37 UTC (Mon) by miallen (guest, #10195) [Link]

Why not just create a "casefs" VFS that just uses the existing ops for the target mounted fs but overloads lookup() to do the caseless pathwalk (and maybe save the last N paths with hashes in a separate cache)? Now you would just (re)mount an existing fs through this casefs VFS. It wouldn't be optimal but it would still be a lot faster for Samba, WINE, or whoever and it wouldn't barf all over any other kernel code. It's probably not a lot of code either.


Re-mount Through Caseless VFS?

Posted Feb 23, 2004 7:40 UTC (Mon) by massimiliano (subscriber, #3048) [Link]

I am definitely not a kernel developer, but this sounds like
the perfect solution: very general, and perfectly decoupled
from the code of existing filesystems... and moreover, you pay
the performance penalty only if you use the feature.

As an added benefit, it could be implemented entirely in user
space using FUSE, and only if/when it works very well (and the
added performance is needed) as a kernel module.

With such a layer, it would also be possible to handle all those
nasty Unicode normalizations...

Just my two cents, anyway.

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds