Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3609384ybn; Fri, 27 Sep 2019 08:44:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhVeE3xdVZ6gZ1Kl50tcnwug7RHeg872Jsl60zHivUr8TXjLZoDl7iOG4hz3NgN1APB66Q X-Received: by 2002:a17:906:82d3:: with SMTP id a19mr8250415ejy.151.1569599079451; Fri, 27 Sep 2019 08:44:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569599079; cv=none; d=google.com; s=arc-20160816; b=LuRINC6AQTvJbl9zdKIwRPPvhUVO9DWCkTNXawq2IWVJiAwEdfVbDQeDd5RCyHlkBn LP8MIxJrSpSl4ouUR+pA4Xi8/6bXVReB+v2vzPGO/JqqAh0nUsdAJepKFac2EESKA3zv 4lFFJu6UK/2y5CX46c0qd/bokUnXiH12oa5/b28JDO8QJk9/BFetEkKlGtk4giD/636U KJkbSlvmb9ZK0Nv9eo5ECP66BEl9xP8CtZSW7BkH0lPnp5YJ2z2mM2z6DFEiQlu407IN SI3N3cWzKM2MAzu9RFJBS3orIP3WuMDPFhOpHAU6bhl3aiMu7eP63X5suqn9bEgmzOyC su9A== 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=BOiQAs/dycY1kmUyfLZPC/1iqRvlu59B1uaBvrLInIQ=; b=LjMlKomB/esiFepvYhNb89a843cDANUH2G2QHMEsC3oFdGlIAXlmy/9hjR0jhiLMCE U1zCvk9z7j9lI/rlrztcBiI3UXlAh/D6DLncw5uwRcDiYXHogg3RMy4EVahZZZQ1TA5G 3reRCdZUZnFkc8sXD9By3Tppkbgjic7hHCL/Tv5iRcgRfP0vZOpyfc6870dm5tNiqofJ PQ7cd664oGF5TJDiUllWEW58fIswynPk4hlN6tXnWiSOWfzZd059HAUcBO2xg2KnK6Hj 6Bi7vx4DF9IlU2bgkPOkZgSC7heqJb8jQDlYbNAyX4rxUL6YhSnveEw/Je3HiHVexVNO Fb1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=f2mV2a37; 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 s24si2878924ejb.16.2019.09.27.08.44.14; Fri, 27 Sep 2019 08:44:39 -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=f2mV2a37; 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 S1727952AbfI0PnX (ORCPT + 99 others); Fri, 27 Sep 2019 11:43:23 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:22701 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727207AbfI0PnX (ORCPT ); Fri, 27 Sep 2019 11:43:23 -0400 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (authenticated) by conssluserg-05.nifty.com with ESMTP id x8RFh5SZ030066 for ; Sat, 28 Sep 2019 00:43:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com x8RFh5SZ030066 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1569598986; bh=BOiQAs/dycY1kmUyfLZPC/1iqRvlu59B1uaBvrLInIQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=f2mV2a37HZIvCuV52P5lsI4T0Z82x6+Xzl3HQWFVGlcQQatHtWv6jZmThewB+YWV/ B73rlEt0zFRZN/FV1mBITxfZmlTz5B6a4GdchQFUqrHsMuHQfQDOOsbkqWCR4DAVNl 6CLQwkcDqIAeKuI98cQE8/Ar9SKBpD2PwOQRi4Gm/KHA5DyWAFksP+DycdhR7vfTHU 2JSHvC0eko205huQV9Wbst2D+nhllx/TYcHS4Yvq7JFGgqn/U/vjYHwQjMViwaqyka MITcruRVhISNpLg+qgBi2c6lwu5QJGSjHFD33xnZo0k6eMiP4zXr4/1Tkbdlk0S65r 9oTPKCd7epAMA== X-Nifty-SrcIP: [209.85.217.44] Received: by mail-vs1-f44.google.com with SMTP id s7so2178073vsl.2 for ; Fri, 27 Sep 2019 08:43:05 -0700 (PDT) X-Gm-Message-State: APjAAAVvhverQ2MhdRfNFZpkWJ/TJ1g0mQX4L1qEanRX5N5BVJHe8KY5 EKn+RKgumNvLVZ6l8wrJ/CC+zjMZAtRUgBi5A5g= X-Received: by 2002:a67:1e87:: with SMTP id e129mr2906177vse.179.1569598984837; Fri, 27 Sep 2019 08:43:04 -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> In-Reply-To: <20190927132726.GB187147@google.com> From: Masahiro Yamada Date: Sat, 28 Sep 2019 00:42:28 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 7/7] nsdeps: make generated patches independent of locale To: Matthias Maennich Cc: Jessica Yu , Greg Kroah-Hartman , 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 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. > With this > > Reviewed-by: Matthias Maennich > > Cheers, > Matthias > > > tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp > > if ! diff -q ${source_file} ${source_file}.tmp; then > > mv ${source_file}.tmp ${source_file} > >-- > >2.17.1 > > -- Best Regards Masahiro Yamada