From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 088DBC3F2D1 for ; Mon, 2 Mar 2020 12:54:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7FCC2187F for ; Mon, 2 Mar 2020 12:54:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="aU8OrciQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727784AbgCBMyd (ORCPT ); Mon, 2 Mar 2020 07:54:33 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:58284 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727497AbgCBMyd (ORCPT ); Mon, 2 Mar 2020 07:54:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Nhw0MyTwnMoRWiNQ3WoBjVjfgBy1tdHCwpldhLXeSH8=; b=aU8OrciQmEGwZ6570fjY/eMdvR X1kANb83Bq0fTIhznB+kIfB4p/5nRzMJ7czJPnaY1OXFrD/5TUBR+PFPEHLrCqQDQMz6TdNGnZ3Nc 7CTNKOiQTzP9xr6E5inn3lrjbzESMTDxTie7XXD9eE0giZ1TpdPHlquxev2i7CD5vvaUX4pDlI2dU UpOW2ruUCQKsYOHi7firLkgbbyjrjLtZeiKJjjjkrXx58gxEFg/iqUxL9SqooGp4tOTSBk+HE88hQ I2cIAioRqtlpmlUcxJlCQMwI6HiYZAF8h+0UoyH3P8FPHC26Re7WppYBXdIp05X7R46PwmGTJVtDk lWMQ6L1w==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j8kae-0000q8-Ok; Mon, 02 Mar 2020 12:54:32 +0000 Date: Mon, 2 Mar 2020 04:54:32 -0800 From: Matthew Wilcox To: lampahome Cc: linux-fsdevel@vger.kernel.org Subject: Re: why do we need utf8 normalization when compare name? Message-ID: <20200302125432.GP29971@bombadil.infradead.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Mar 02, 2020 at 05:00:24PM +0800, lampahome wrote: > According to case insensitive since kernel 5.2, d_compare will > transform string into normalized form and then compare. > > But why do we need this normalization function? Could we just compare > by utf8 string? Have you read https://en.wikipedia.org/wiki/Unicode_equivalence ? We need to decide whether a user with a case-insensitive filesystem who looks up a file with the name U+00E5 (lower case "a" with ring) should find a file which is named U+00C5 (upper case "A" with ring) or U+212B (Angstrom sign). Then there's the question of whether e-acute is stored as U+00E9 or U+0065 followed by U+0301, and both of those will need to be found by a user search for U+00C9 or a user searching for U+0045 U+0301. So yes, normalisation needs to be done.