lkml.org 
[lkml]   [2020]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: vfat: Broken case-insensitive support for UTF-8
On Mon, Jan 20, 2020 at 03:47:22PM +0000, David Laight wrote:
> From: Pali Rohár
> > Sent: 20 January 2020 15:20
> ...
> > This is not possible. There is 1:1 mapping between UTF-8 sequence and
> > Unicode code point. wchar_t in kernel represent either one Unicode code
> > point (limited up to U+FFFF in NLS framework functions) or 2bytes in
> > UTF-16 sequence (only in utf8s_to_utf16s() and utf16s_to_utf8s()
> > functions).
>
> Unfortunately there is neither a 1:1 mapping of all possible byte sequences
> to wchar_t (or unicode code points), nor a 1:1 mapping of all possible
> wchar_t values to UTF-8.
> Really both need to be defined - even for otherwise 'invalid' sequences.

Who. Cares?

Filename is a sequence of octets, not codepoints. Its interpretation is
entirely up to the userland.

Same goes for the notion of "case" (locale-dependent, etc.); some
filesystems impose their (arbitrary) restrictions on the possible
octet sequences (and equally arbitrary equivalence relations between
them) that can be approximated in terms of upper/lower case in some
locale. It does not matter how arbitrary those are, or what stands
behind them:
* don't do that for any new filesystem designs
* for existing filesystem types, the actual behaviour of
native implementation IS THE ONE AND ONLY AUTHORITY. It does not
matter from what misguided thought process it has come from;
the absolute requirement is that if you mount a filesystem valid
from the native implementation POV, you must leave it in a state
that would be valid from the native implementation POV. That's
it.

Any talk about normalization, etc. is completely pointless -
for any sane uses it's an opaque stream of octets that filesystem
and VFS should leave the fuck alone. Codepoints, encodings, etc.
come into the game only to an extent they are useful to describe
the weird rules given filesystem might have. And they are just
that - tools to describe externally imposed mappings.

\
 
 \ /
  Last update: 2020-01-20 17:13    [W:0.084 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site