Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5324223ybn; Sat, 28 Sep 2019 18:34:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4JkGSqEj0p6W4znNUV2NpFvmcOBGQJqNH/agSvip5/d2GG8pM+l0GYKU/Pt3CUDz6nz+a X-Received: by 2002:aa7:d386:: with SMTP id x6mr12407581edq.264.1569720897496; Sat, 28 Sep 2019 18:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569720897; cv=none; d=google.com; s=arc-20160816; b=kKHmC86lEfMST5b2j7898KVZ79lJcq/38A4vU4hc7cAsYt2RrHgFOyviDrXk4vizQl QoeAhNhiYmFbehoWf5XBeb1X8hn5P3/ETClebwa2zal7rmiPvTxU3TABH868OEX4KlQ/ imREuJ8cXSzj/LFDFukrR5Xz5RFPnFl75VOzIEA65wnl/te9+awvP8faUZl+/QlZQ/ep 6Mg+TirhuxpgxnGMl1JAnivEoAV3dcYxUtusMabcoZUkBVgkmMlO2TADFDN2dkCprQUx IfZK62mVryQty+L0OjEdUEYRoL2ElwxuBaHL7VHbb8f1wYLqYEjR+4wkL1IiXrLIN1Qv y06Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=hTzswXoVvRMq0HEW4oc27Djtr+jRVat/fCYdbK8jNqY=; b=OjkIL6NDb+1P/Nl/c5tCfXE4cucvpABQEnaUA+VPxc+taVTAlFjPJR0TeJqfR2GIYU 0tIQVVTnK8MTDeW7rPJ2ZiCtc/cccN2DoZ/8EcfQGwwASHk8hbSXq60r4QYUYJGEyE8Q yXVjB+8TEWm6mM43ns7r6N7oGwjxKxx6zOC9JltAce3QVG9sbHsHBOuoz8noDg4GKa2v BCgTT0CLZGPoe7x+8VWWpa3vA30iJHmYCtl6p+BUzV2S5th8NEkK924L99g+Bw4KMr3b 4hbMJP9FFb13dT92TU10WP+scLzO8uDZu1eAGVf40FuEIoe2uBlNKyqRmIB3xOehhzLk kZsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=NLybHHBX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si5034048eja.38.2019.09.28.18.34.23; Sat, 28 Sep 2019 18:34:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=NLybHHBX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728900AbfI2BbX (ORCPT + 99 others); Sat, 28 Sep 2019 21:31:23 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:28324 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728569AbfI2BbX (ORCPT ); Sat, 28 Sep 2019 21:31:23 -0400 Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) (authenticated) by conssluserg-05.nifty.com with ESMTP id x8T1V3WX002731 for ; Sun, 29 Sep 2019 10:31:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com x8T1V3WX002731 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1569720664; bh=hTzswXoVvRMq0HEW4oc27Djtr+jRVat/fCYdbK8jNqY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NLybHHBXa6PsV8OtEkGVEB2sZ1z4iTpMktSwO6VtCNmAdNq3rjVtP4N9/KLvkC4ci bR3kIqe6G5ev9XUGkfyNjA2v6Kj5cvLHVdJGwYUJoyQ7hmQCB094iOtTFbLGdMji4d FcGkCYhwxbFZQrLD5j/Z1S81bIIQ/46GCu14y8SG0AOviNALE90qCk3DDVElMMRdai dqZUay+fvBoeurEjo+wrsIgj6cMFCxX+VuEBm4tZZ0S9VU3laP/npkunm4UiDxbCSb R1u8mhBkwcXjDRoA0sDM60wglpAdh/I7yE3UW6lLLInXji7bAqy4zPr+op8vEhPNne T+ILcU/dM8Ryw== X-Nifty-SrcIP: [209.85.217.42] Received: by mail-vs1-f42.google.com with SMTP id d204so4406327vsc.12 for ; Sat, 28 Sep 2019 18:31:04 -0700 (PDT) X-Gm-Message-State: APjAAAW3m9TFi3yaW4BxeZt+CJp789FYVX913Hh0NCY4/MZV2qGc9UA2 jDCxUj8vJhKFcmA5u0nr08f1QUb9UuvC6MXu0Kg= X-Received: by 2002:a67:1e87:: with SMTP id e129mr6765861vse.179.1569720663296; Sat, 28 Sep 2019 18:31:03 -0700 (PDT) MIME-Version: 1.0 References: <20190927093603.9140-1-yamada.masahiro@socionext.com> <20190927093603.9140-8-yamada.masahiro@socionext.com> <20190927132726.GB187147@google.com> <20190927181414.GB1804168@kroah.com> In-Reply-To: From: Masahiro Yamada Date: Sun, 29 Sep 2019 10:30:27 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 7/7] nsdeps: make generated patches independent of locale To: Greg Kroah-Hartman Cc: Matthias Maennich , Jessica Yu , Joel Fernandes , Martijn Coenen , Will Deacon , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 29, 2019 at 10:18 AM Masahiro Yamada wrote: > > On Sat, Sep 28, 2019 at 3:14 AM Greg Kroah-Hartman > wrote: > > > > On Sat, Sep 28, 2019 at 12:42:28AM +0900, Masahiro Yamada wrote: > > > On Fri, Sep 27, 2019 at 10:27 PM Matthias Maennich wrote: > > > > > > > > On Fri, Sep 27, 2019 at 06:36:03PM +0900, Masahiro Yamada wrote: > > > > >scripts/nsdeps automatically generates a patch to add MODULE_IMPORT_NS > > > > >tags, and what is nicer, it sorts the lines alphabetically with the > > > > >"sort" command. However, the output from the "sort" command depends > > > > >on locale. > > > > > > > > > >Especially when namespaces contain underscores, the result is > > > > >different depending on the locale. > > > > > > > > > >For example, I got this: > > > > > > > > > >$ { echo usbcommon; echo usb_common; } | LANG=en_US.UTF-8 sort > > > > >usbcommon > > > > >usb_common > > > > >$ { echo usbcommon; echo usb_common; } | LANG=C sort > > > > >usb_common > > > > >usbcommon > > > > > > > > > >So, this means people might potentially send different patches. > > > > > > > > > >This kind of issue was reported in the past, for example, > > > > >commit f55f2328bb28 ("kbuild: make sorting initramfs contents > > > > >independent of locale"). > > > > > > > > > >Adding "LANG=C" is a conventional way of fixing when a deterministic > > > > >result is desirable. > > > > > > > > > >Signed-off-by: Masahiro Yamada > > > > >--- > > > > > > > > > > scripts/nsdeps | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > >diff --git a/scripts/nsdeps b/scripts/nsdeps > > > > >index 964b7fb8c546..3754dac13b31 100644 > > > > >--- a/scripts/nsdeps > > > > >+++ b/scripts/nsdeps > > > > >@@ -41,7 +41,7 @@ generate_deps() { > > > > > for source_file in $mod_source_files; do > > > > > sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp > > > > > offset=$(wc -l ${source_file}.tmp | awk '{print $1;}') > > > > >- cat $source_file | grep MODULE_IMPORT_NS | sort -u >> ${source_file}.tmp > > > > >+ cat $source_file | grep MODULE_IMPORT_NS | LANG=C sort -u >> ${source_file}.tmp > > > > > > > > I would prefer to have this set throughout the whole runtime of the > > > > script. Otherwise we likely see a followup patch. So, either as an > > > > export at the beginning of this file or as part of the command that > > > > calls this script. > > > > > > > > > I prefer to keep it close to the locale-dependent code. > > > > > > > > > > > > If I move it to somewhere else, I need to add a comment like > > > > > > # make "sort" command deterministic > > > export LANG=C > > > > > > Otherwise, people would have no idea why it is needed. > > > > A comment is fine, it documents why it is here and it keeps anyone from > > having to remember to add it to anything else that changes in here. > > > > thanks, > > > > greg k-h > > > Huh, people who live in a country with English as mother tongue > cannot understand the i18n because English is the > only language in the world? I take back this comment. I actually do not know where you live, or what native language you speak. It was used to exaggerate things, but It is not important to the point of discussions. Sorry. -- Best Regards Masahiro Yamada