From 82590fed5fe04aa2503e36e81c84b1e3455780e5 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 22 Sep 2021 16:53:19 +0200 Subject: [PATCH] glibcLocales: Fix build for duplicates in locales list Without this patch, setting the same locale twice, e.g. like this in NixOS: ```nix { i18n.supportedLocales = [ (config.i18n.defaultLocale + "/UTF-8") (config.i18n.defaultLocale + "/UTF-8") ]; } ``` Would make the glibcLocales build fail with ``` Error: unsupported locales detected: en_US.UTF-8/UTF-8 \ You should choose from the list above the error. ``` --- pkgs/development/libraries/glibc/locales.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/glibc/locales.nix b/pkgs/development/libraries/glibc/locales.nix index 325e0d09936b..208eedd71934 100644 --- a/pkgs/development/libraries/glibc/locales.nix +++ b/pkgs/development/libraries/glibc/locales.nix @@ -34,9 +34,9 @@ callPackage ./common.nix { inherit stdenv; } { + lib.optionalString (!allLocales) '' # Check that all locales to be built are supported echo -n '${lib.concatMapStrings (s: s + " \\\n") locales}' \ - | sort > locales-to-build.txt + | sort -u > locales-to-build.txt cat ../glibc-2*/localedata/SUPPORTED | grep ' \\' \ - | sort > locales-supported.txt + | sort -u > locales-supported.txt comm -13 locales-supported.txt locales-to-build.txt \ > locales-unsupported.txt if [[ $(wc -c locales-unsupported.txt) != "0 locales-unsupported.txt" ]]; then