All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Maennich <maennich@google.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jessica Yu <jeyu@kernel.org>,
	Joel Fernandes <joel@joelfernandes.org>,
	Martijn Coenen <maco@android.com>,
	Will Deacon <will.deacon@arm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/7] nsdeps: make generated patches independent of locale
Date: Tue, 1 Oct 2019 12:46:52 +0100	[thread overview]
Message-ID: <20191001114652.GD253280@google.com> (raw)
In-Reply-To: <CAK7LNAR7QwfMRKwc1DwaRQW3GA-tBHhSv=yVq+xR_YkpYAnc6w@mail.gmail.com>

On Sun, Sep 29, 2019 at 10:30:27AM +0900, Masahiro Yamada wrote:
>On Sun, Sep 29, 2019 at 10:18 AM Masahiro Yamada
><yamada.masahiro@socionext.com> wrote:
>>
>> On Sat, Sep 28, 2019 at 3:14 AM Greg Kroah-Hartman
>> <gregkh@linuxfoundation.org> 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 <maennich@google.com> 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 <yamada.masahiro@socionext.com>
>> > > > >---
>> > > > >
>> > > > > 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.

Thanks for pointing this out and reminding us! I am not a native English
speaker, but often are surrounded by English, especially when
programming. Error messages in my native language feel often rather
funny than helpful, but I guess this not the case for most translations.
Based on that I am ok with your original version of the patch.

Cheers,
Matthias

  reply	other threads:[~2019-10-01 11:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27  9:35 [PATCH 0/7] module: various bug-fixes and clean-ups for module namespace Masahiro Yamada
2019-09-27  9:35 ` [PATCH 1/7] modpost: fix broken sym->namespace for external module builds Masahiro Yamada
2019-09-27  9:56   ` Masahiro Yamada
2019-09-27 11:46   ` Matthias Maennich
2019-09-27  9:35 ` [PATCH 2/7] module: swap the order of symbol.namespace Masahiro Yamada
2019-09-27 12:07   ` Matthias Maennich
2019-09-27  9:35 ` [PATCH 3/7] module: rename __kstrtab_ns_* to __kstrtabns_* to avoid symbol conflict Masahiro Yamada
2019-09-27 12:14   ` Matthias Maennich
2019-09-27  9:36 ` [PATCH 4/7] module: avoid code duplication in include/linux/export.h Masahiro Yamada
2019-09-27  9:58   ` Masahiro Yamada
2019-09-27 11:07   ` Rasmus Villemoes
2019-09-27 12:36     ` Matthias Maennich
2019-10-29 19:19     ` Jessica Yu
2019-10-29 21:11       ` Rasmus Villemoes
2019-10-31 10:13         ` Jessica Yu
2019-10-31 11:03           ` Rasmus Villemoes
2019-10-31 11:26             ` Jessica Yu
2019-09-27  9:36 ` [PATCH 5/7] kbuild: fix build error of 'make nsdeps' in clean tree Masahiro Yamada
2019-09-27 12:44   ` Matthias Maennich
2019-09-27  9:36 ` [PATCH 6/7] nsdeps: fix hashbang of scripts/nsdeps Masahiro Yamada
2019-09-27 13:10   ` Matthias Maennich
2019-09-27  9:36 ` [PATCH 7/7] nsdeps: make generated patches independent of locale Masahiro Yamada
2019-09-27 13:27   ` Matthias Maennich
2019-09-27 15:42     ` Masahiro Yamada
2019-09-27 18:14       ` Greg Kroah-Hartman
2019-09-29  1:18         ` Masahiro Yamada
2019-09-29  1:30           ` Masahiro Yamada
2019-10-01 11:46             ` Matthias Maennich [this message]
2019-09-29 10:14           ` Greg Kroah-Hartman
2019-09-27 13:41 ` [PATCH 0/7] module: various bug-fixes and clean-ups for module namespace Matthias Maennich
2019-09-27 15:43   ` Masahiro Yamada
2019-10-02 18:57   ` Jessica Yu
2019-10-02 20:43     ` Matthias Maennich
2019-10-03  1:26     ` Masahiro Yamada
2019-10-03  8:03     ` Masahiro Yamada

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=20191001114652.GD253280@google.com \
    --to=maennich@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeyu@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=will.deacon@arm.com \
    --cc=yamada.masahiro@socionext.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.