Skip to content
  • Masahiro Yamada's avatar
    nsdeps: make generated patches independent of locale · df6f0987
    Masahiro Yamada authored
    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.
    
    For example, I got this:
    
    $ { echo usbstorage; echo usb_storage; } | LANG=en_US.UTF-8 sort
    usbstorage
    usb_storage
    $ { echo usbstorage; echo usb_storage; } | LANG=C sort
    usb_storage
    usbstorage
    
    So, this means people might potentially send different patches.
    
    This kind of issue was reported in the past, for example,
    commit f55f2328
    
     ("kbuild: make sorting initramfs contents
    independent of locale").
    
    Adding 'LANG=C' is a conventional way of fixing when a deterministic
    result is desirable.
    
    I added 'LANG=C' very close to the 'sort' command since changing
    locale affects the language of error messages etc. We should respect
    users' choice as much as possible.
    
    Reviewed-by: default avatarMatthias Maennich <maennich@google.com>
    Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
    df6f0987