Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3781829ybn; Fri, 27 Sep 2019 11:15:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv1BCKCSrbjD6NKKBMAB018bMG6/uFyBX91ORYKr3T56rNrERbPR1lZsz6yUJDXNUni52i X-Received: by 2002:a17:906:349a:: with SMTP id g26mr8715934ejb.77.1569608130768; Fri, 27 Sep 2019 11:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569608130; cv=none; d=google.com; s=arc-20160816; b=hc6i9vcz045HHDwSOffQ3pj3CqY3TkFtb3bEOak6SW7VO2CqdPaEA0vs56M/zCD37l 9gqBYEIfc/WheFzIAPi6NgxRU5WL7t4oRALOQ1JaP6FDTkpd4Yf7gjCj7uzsWSgkCe5L uRThCvePalt0PwIV6icU3asEh6lFZndiWh5itSFejLnl7gJ1AwBIl92I/1nYyzX0VKBH /BLdmY24LWFducGl/IaPgoQPllwj51fEBTy2ACf2ObeUOWo00jxZ9lMKPYhRlUXhMwEu XzAsi11bACmRwaMGv0zxkPTRihtN7EZLdxKfe+LTk/vmdPt5XN6yYXGIWgAK5RsXvz+y rjGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RTtsT7dnzXtMOoxwcNCMUck1TIgFUeDvXc73DEwybWo=; b=ZCmZO5kpX+9+PQhZx8LeGd6j21fO4+E9Bd81cch/FaQteUN6DTcw30F56mi+RxCTFz gPNpinO+tSQDVcDgHqq5mVqHhCv+E6Dh6ShLMS2h0Z+E+JQfBTNCDBkTMF+uNuOPpScd LILFdsK9iWlGjZQyz0jIilehOMrs1lNujqyt2ArnQOGqQNg9aFm59DGpHw1cFPeSas9G 4kWMLUsHw5P9V02AdytTEzbPnXbLGbVFHLTI3d6gSZ3cmrx0S1T7pW+YM66rPzCdMAIt N/p6SNQZPudvTCjpTE9zF0stm4vHpJyA00xpVl/OG/hvEm8KgcFelJ7XP/++8GQ9Y708 pJUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KLhuMF7+; 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 ox10si3181392ejb.325.2019.09.27.11.15.05; Fri, 27 Sep 2019 11:15:30 -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=@kernel.org header.s=default header.b=KLhuMF7+; 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 S1727747AbfI0SO4 (ORCPT + 99 others); Fri, 27 Sep 2019 14:14:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:57778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbfI0SO4 (ORCPT ); Fri, 27 Sep 2019 14:14:56 -0400 Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D2A02207FF; Fri, 27 Sep 2019 18:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569608094; bh=4sur/3utEGTOycoGH95qWurmb4IQuA8KLFKiKWKmrjg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KLhuMF7+e7tO8IfHcrTbGwBMr5Tv8BMx+E/913PUmWGpkFYZ9Lcx0O63hpdu81sYr 88ASYgzh3DeOTtSZp1tg/evZxU50VSkRm3ojrWaSCFmsIzcUi+/WrhBhlJZcAFsXAq uTKvpOrWyjF5h9Zjq3fhFSgbzN6Oi8By6Fx2Qgxk= Date: Fri, 27 Sep 2019 20:14:14 +0200 From: Greg Kroah-Hartman To: Masahiro Yamada Cc: Matthias Maennich , Jessica Yu , Joel Fernandes , Martijn Coenen , Will Deacon , Linux Kernel Mailing List Subject: Re: [PATCH 7/7] nsdeps: make generated patches independent of locale Message-ID: <20190927181414.GB1804168@kroah.com> References: <20190927093603.9140-1-yamada.masahiro@socionext.com> <20190927093603.9140-8-yamada.masahiro@socionext.com> <20190927132726.GB187147@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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