From: "Pali Rohár" <pali.rohar@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"Theodore Y. Ts'o" <tytso@mit.edu>,
Namjae Jeon <linkinjeon@gmail.com>,
Gabriel Krisman Bertazi <krisman@collabora.com>
Subject: Re: vfat: Broken case-insensitive support for UTF-8
Date: Mon, 20 Jan 2020 16:20:09 +0100 [thread overview]
Message-ID: <20200120152009.5vbemgmvhke4qupq@pali> (raw)
In-Reply-To: <89eba9906011446f8441090f496278d2@AcuMS.aculab.com>
On Monday 20 January 2020 15:07:20 David Laight wrote:
> From: Pali Rohár
> > Sent: 20 January 2020 11:05
> > On Monday 20 January 2020 13:04:42 OGAWA Hirofumi wrote:
> > > Pali Rohár <pali.rohar@gmail.com> writes:
> > >
> > > > Which means that fat_name_match(), vfat_hashi() and vfat_cmpi() are
> > > > broken for vfat in UTF-8 mode.
> > >
> > > Right. It is a known issue.
> >
> > Could be this issue better documented? E.g. in mount(8) manpage where
> > are written mount options for vfat? I think that people should be aware
> > of this issue when they use "utf8=1" mount option.
>
> What happens if the filesystem has filenames that invalid UTF8 sequences
Could you please describe what you mean by this question?
VFAT filesystem stores file names in UTF-16. Therefore you cannot have
UTF-8 on FS (and therefore also you cannot have invalid UTF-8).
Ehm... UTF-16 is not fully truth, MS FAT32 implementations allows half
of UTF-16 surrogate pair stored in FS.
Therefore practically, on VFAT you can store any uint16_t[] sequence as
filename, there is no invalid sequence (except those characters like
:<>?... which are invalid in MS-DOS).
If by "the filesystem has filenames" you do not mean filesystem file
names, but rather Linux VFS file names (e.g. you call creat() call with
invalid UTF-8 sequence) then function utf8s_to_utf16s() (called in
namei_vfat.c) fails and returns error. Which should be propagated to
open() / creat() call that it is not possible to create filename with
such UTF-8 sequence.
> or multiple filenames that decode from UTF8 to the same 'wchar' value.
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).
> Never mind ones that are just case-differences for the same filename.
>
> UTF8 is just so broken it should never have been allowed to become
> a standard.
Well, UTF-16 is worse then UTF-8... incompatible with ASCII, variable
length and space consuming.
--
Pali Rohár
pali.rohar@gmail.com
next prev parent reply other threads:[~2020-01-20 15:20 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-19 22:14 vfat: Broken case-insensitive support for UTF-8 Pali Rohár
2020-01-19 23:08 ` Al Viro
2020-01-19 23:33 ` Pali Rohár
2020-01-20 0:09 ` Al Viro
2020-01-20 11:19 ` Pali Rohár
2020-01-20 4:04 ` OGAWA Hirofumi
2020-01-20 7:30 ` Al Viro
2020-01-20 7:45 ` Al Viro
2020-01-20 8:07 ` oopsably broken case-insensitive support in ext4 and f2fs (Re: vfat: Broken case-insensitive support for UTF-8) Al Viro
2020-01-20 19:35 ` Al Viro
2020-01-24 4:29 ` Eric Biggers
2020-01-24 17:47 ` Linus Torvalds
2020-01-24 18:03 ` Jaegeuk Kim
2020-01-24 18:45 ` Eric Biggers
2020-01-20 11:04 ` vfat: Broken case-insensitive support for UTF-8 Pali Rohár
2020-01-20 12:07 ` OGAWA Hirofumi
2020-01-20 21:40 ` Pali Rohár
2020-01-20 22:46 ` Al Viro
2020-01-20 23:57 ` Pali Rohár
2020-01-21 0:07 ` Al Viro
2020-01-21 20:34 ` Pali Rohár
2020-01-21 21:36 ` Al Viro
2020-01-21 22:14 ` Al Viro
2020-01-21 22:46 ` Pali Rohár
2020-01-26 23:08 ` Pali Rohár
2020-01-21 12:43 ` David Laight
2020-01-22 0:25 ` Gabriel Krisman Bertazi
2020-01-20 15:07 ` David Laight
2020-01-20 15:20 ` Pali Rohár [this message]
2020-01-20 15:47 ` David Laight
2020-01-20 16:12 ` Al Viro
2020-01-20 16:51 ` David Laight
2020-01-20 16:27 ` Pali Rohár
2020-01-20 16:43 ` David Laight
2020-01-20 16:56 ` Pali Rohár
2020-01-20 17:37 ` Theodore Y. Ts'o
2020-01-20 17:32 ` Theodore Y. Ts'o
2020-01-20 17:56 ` Pali Rohár
2020-01-21 3:52 ` OGAWA Hirofumi
2020-01-21 11:00 ` Pali Rohár
2020-01-21 12:26 ` OGAWA Hirofumi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200120152009.5vbemgmvhke4qupq@pali \
--to=pali.rohar@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=hirofumi@mail.parknet.co.jp \
--cc=krisman@collabora.com \
--cc=linkinjeon@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).