[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200120161206.GC8904@ZenIV.linux.org.uk>
Date: Mon, 20 Jan 2020 16:12:06 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: David Laight <David.Laight@...lab.com>
Cc: 'Pali Rohár' <pali.rohar@...il.com>,
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"Theodore Y. Ts'o" <tytso@....edu>,
Namjae Jeon <linkinjeon@...il.com>,
Gabriel Krisman Bertazi <krisman@...labora.com>
Subject: Re: 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.
Powered by blists - more mailing lists