linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: "Theodore Y. Ts'o" <tytso@mit.edu>
Cc: kernel@collabora.com, linux-ext4@vger.kernel.org
Subject: Re: [PATCH v3 01/12] libe2p: Helpers for configuring the encoding superblock fields
Date: Fri, 30 Nov 2018 15:46:20 -0500	[thread overview]
Message-ID: <878t1a1eg3.fsf@collabora.com> (raw)
In-Reply-To: <20181130154243.GR31885@thunk.org> (Theodore Y. Ts'o's message of "Fri, 30 Nov 2018 10:42:43 -0500")

"Theodore Y. Ts'o" <tytso@mit.edu> writes:

> On Mon, Nov 26, 2018 at 05:19:38PM -0500, Gabriel Krisman Bertazi wrote:
>> +	/* 0x1 */ {"utf8-10.0", (EXT4_UTF8_NORMALIZATION_TYPE_NFKD |
>> +				 EXT4_UTF8_CASEFOLD_TYPE_NFKDCF)},
>
> We're using 10.0 here even though the later in the patch we're
> installing Unicode 11.0.  What if we just call this utf8-10+?  Unicode
> releases new versions every six months these days, and so long as the
> case fold rules don't change for any existing characters, but are only
> added for new characters added to the new version of Unicode, it would
> definitely be OK for strict mode.
>
> Even in relaxed mode, if someone decided to use, say, Klingon
> characters not recognized by the Unicode consortium in their system,
> and later on the Unicode consortium reassigns those code points to
> some obscure ancient script, it would be unfortunate, how much would
> it be *our* problem?  The worst that could happen is that if case
> folding were enabled, two file names that were previously unique would
> be considered identical by the new case folding rules after the
> rebooting into the new kernel.  If hashed directories were used, one
> or both of the filenames might not be accessible, but it wouldn't lead
> to an actual file system level inconsistency.  And data would only be
> lost if the wrong file were to get accidentally deleted in the
> confusion.

If this is not our problem, it does get much easier.  But we might be
able to assist the user a bit more, if we store the version in the
superblock.

We only allow the user to specify utf8 without requiring a version in
mkfs, just like you said, but we still write the unicode version in the
superblock.  The kernel will always mount using the newest unicode, but
recommend the user to run fsck if there is a version mismatch.  fsck can
then check the filesystem using first the newest version, and if an
invalid is found, it tries to use the exact superblock version.  If the
second attempt doesn't fail, we can rehash the entry, because no real
inconsistencies actually exist. If the rehash triggers a collision, we
could ask the user interactively what to do, if we can be interactive in
fsck (we can't, right?).  Otherwise, if we can't solve the collisions,
we set a flag in the superblock to force the exact version when mounting
the next time.  The user loses normalization of new scripts, but we warn
them about it, and the existing data is preserved and accessible.
Finally, if no collision is detected, or if we can solve all of then, we
write the new hashes and silently update the unicode version flag in the
superblock in fsck.

The interface becomes simpler for the common user, we basically hide
unicode versioning from someone that is not playing with ancient
scripts, and they still benefit from the new version by just rebooting
to an updated kernel.  But we still give the user that actually cares
about ancient scripts a way to fix her situation.

> I'm curious how Windows handles this problem.  Windows and Apple are
> happy to include the latest set of emoji's as they become available
> --- after all, that's a key competitive advantage for some markets :-)
> --- so I'm guessing they must not be terribly strict about Unicode
> versioning, either.  So maybe the right thing to do is to just call it
> "utf8" and be done with it.  :-)

I just did some tests on a macbook.  The machine was on xnu-4570.71.1~1,
which is pre-unicode 11 and creating a file with a unicode 11+ sequence
triggers an "illegal byte sequence" error.  After updating the system
(to xnu-4903.221.2), i can create files using new emoticons. So, from what
i can tell, apple is using a more strict mode that reject invalid
sequences.

Windows seems more permissive, I can create a unicode 11 file on a
system I am sure doesn't have unicode 11 support, since it is much older
than that version, and I can check the file name on disk is the one i
asked for.

-- 
Gabriel Krisman Bertazi

  reply	other threads:[~2018-12-01  7:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26 22:19 [PATCH e2fsprogs v3 00/12] Support encoding awareness and casefold Gabriel Krisman Bertazi
2018-11-26 22:19 ` [PATCH v3 01/12] libe2p: Helpers for configuring the encoding superblock fields Gabriel Krisman Bertazi
2018-11-30 15:42   ` Theodore Y. Ts'o
2018-11-30 20:46     ` Gabriel Krisman Bertazi [this message]
2018-11-26 22:19 ` [PATCH v3 02/12] mke2fs: Configure encoding during superblock initialization Gabriel Krisman Bertazi
2018-11-26 22:19 ` [PATCH v3 03/12] chattr/lsattr: Support casefold attribute Gabriel Krisman Bertazi
2018-11-26 22:19 ` [PATCH v3 04/12] lib/ext2fs: Implement NLS support Gabriel Krisman Bertazi
2018-11-30 15:54   ` Theodore Y. Ts'o
2018-11-26 22:19 ` [PATCH v3 05/12] lib/ext2fs: Support encoding when calculating dx hashes Gabriel Krisman Bertazi
2018-11-26 22:19 ` [PATCH v3 06/12] debugfs/htree: Support encoding when printing the file hash Gabriel Krisman Bertazi
2018-11-26 22:19 ` [PATCH v3 07/12] tune2fs: Prevent enabling encryption flag on encoding-aware fs Gabriel Krisman Bertazi
2018-11-26 22:19 ` [PATCH v3 09/12] ext4.5: Add fname_encoding feature to ext4 man page Gabriel Krisman Bertazi
2018-11-26 22:19 ` [PATCH v3 10/12] mke2fs.8: Document fname_encoding options Gabriel Krisman Bertazi
2018-11-30 15:59   ` Theodore Y. Ts'o
2018-11-26 22:19 ` [PATCH v3 11/12] mke2fs.conf.5: Document fname_encoding configuration option Gabriel Krisman Bertazi
2018-11-26 22:19 ` [PATCH v3 12/12] chattr.1: Document the casefold attribute Gabriel Krisman Bertazi
     [not found] ` <20181126221949.12172-9-krisman@collabora.com>
2018-11-30 16:12   ` [PATCH v3 08/12] ext2fs: nls: Support UTF-8 11.0 with NFKD normalization Theodore Y. Ts'o
2018-11-30 16:53   ` Theodore Y. Ts'o
2018-11-30 18:48     ` Gabriel Krisman Bertazi

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=878t1a1eg3.fsf@collabora.com \
    --to=krisman@collabora.com \
    --cc=kernel@collabora.com \
    --cc=linux-ext4@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).