From 0da898ca39a9b860fbd50cdde781286ec52f4194 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 11 Jun 2022 11:21:56 +0100 Subject: [PATCH 1/4] glibcLocalesUtf8: init at 2.34 glibcLocalesUtf8 is a trimmed down version of glibcLocales that provides UTF-8 locale. It is useful to use in derivations that need some UTF-8 lcoale, like unzip in https://github.com/NixOS/nixpkgs/pull/176253. --- pkgs/top-level/all-packages.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 17fd806562a..b7fb0707b6c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17505,7 +17505,14 @@ with pkgs; relibc = callPackage ../development/libraries/relibc { }; # Only supported on Linux - glibcLocales = if stdenv.hostPlatform.isLinux then callPackage ../development/libraries/glibc/locales.nix { } else null; + glibcLocales = + if stdenv.hostPlatform.isLinux + then callPackage ../development/libraries/glibc/locales.nix { } + else null; + glibcLocalesUtf8 = + if stdenv.hostPlatform.isLinux + then callPackage ../development/libraries/glibc/locales.nix { allLocales = false; } + else null; glibcInfo = callPackage ../development/libraries/glibc/info.nix { }; From ffb456ae61d1740b5b254f6d431801782d7ab0d7 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 4 Jun 2022 15:38:56 +0100 Subject: [PATCH 2/4] fetchzip: force UTF-8 compatibel locale to unpack non-ASCII symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit musl and darwin support UTF-8 locales without any extras. As a result unzip can unpack UTF-8 filenames there as is. But on glibc without locale archive presence files get mangled as: deps/αβ -> deps/#U03b1#U03b2 This makes `fetchzip` fixed-output derivations unstable. Tested this change to fail in `coq.src` which was generated in system that mangles UTF-8 symbols: $ nix build -f. coq.src --rebuild -L source> trying https://github.com/coq/coq/archive/V8.15.2.zip source> % Total % Received % Xferd Average Speed Time Time Time Current source> Dload Upload Total Spent Left Speed source> 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 source> 100 8945k 100 8945k 0 0 1513k 0 0:00:05 0:00:05 --:--:-- 1989k source> unpacking source archive /build/V8.15.2.zip error: hash mismatch in fixed-output derivation '/nix/store/hrnyykm7wgw8vxisgq7hc2bg5gr0y6s8-source.drv': specified: sha256-h81nFqkuvZkMR7YLHy7laTq5yOhjMW+w6rYzncxvyD4= got: sha256-DTspmwyD3Evl1CUmvUy2MonbLGUezvsHN3prmP9eK2I= Note: it means that some of existing caches for fixed output derivations become incorrect. It should not break already cached tarballs on cache.nixos.org thus the impact should not be widespread. --- pkgs/build-support/fetchzip/default.nix | 7 +++++-- pkgs/tools/archivers/unzip/setup-hook.sh | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix index 98c41037074..10142134792 100644 --- a/pkgs/build-support/fetchzip/default.nix +++ b/pkgs/build-support/fetchzip/default.nix @@ -5,7 +5,7 @@ # (e.g. due to minor changes in the compression algorithm, or changes # in timestamps). -{ lib, fetchurl, unzip }: +{ lib, fetchurl, unzip, glibcLocalesUtf8 }: { # Optionally move the contents of the unpacked tree up one level. stripRoot ? true @@ -35,7 +35,10 @@ in { downloadToTemp = true; - nativeBuildInputs = [ unzip ] ++ nativeBuildInputs; + # Have to pull in glibcLocalesUtf8 for unzip in setup-hook.sh to handle + # UTF-8 aware locale: + # https://github.com/NixOS/nixpkgs/issues/176225#issuecomment-1146617263 + nativeBuildInputs = [ unzip glibcLocalesUtf8 ] ++ nativeBuildInputs; postFetch = '' diff --git a/pkgs/tools/archivers/unzip/setup-hook.sh b/pkgs/tools/archivers/unzip/setup-hook.sh index 4055d2fab51..99c63f68e94 100644 --- a/pkgs/tools/archivers/unzip/setup-hook.sh +++ b/pkgs/tools/archivers/unzip/setup-hook.sh @@ -1,5 +1,11 @@ unpackCmdHooks+=(_tryUnzip) _tryUnzip() { if ! [[ "$curSrc" =~ \.zip$ ]]; then return 1; fi - unzip -qq "$curSrc" + + # UTF-8 locale is needed for unzip on glibc to handle UTF-8 symbols: + # https://github.com/NixOS/nixpkgs/issues/176225#issuecomment-1146617263 + # Otherwise unzip unpacks escaped file names as if '-U' options was in effect. + # + # Pick en_US.UTF-8 as most possible to be present on glibc, musl and darwin. + LANG=en_US.UTF-8 unzip -qq "$curSrc" } From b543ad569161f123b4652a5b88476f7105887451 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 11 Jun 2022 08:16:35 +0100 Subject: [PATCH 3/4] eduli.src: update hash change with fetchzip update fetchzip changed unpacking of UTF-8 files on glibc systems: https://github.com/NixOS/nixpkgs/pull/176253 As a result unpacked contents changed it's filenames. --- pkgs/data/fonts/eduli/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/data/fonts/eduli/default.nix b/pkgs/data/fonts/eduli/default.nix index 7ff2ad4446c..beb89d49fc3 100644 --- a/pkgs/data/fonts/eduli/default.nix +++ b/pkgs/data/fonts/eduli/default.nix @@ -8,7 +8,7 @@ stdenvNoCC.mkDerivation rec { name = "${pname}-${version}"; url = "http://language.moe.gov.tw/001/Upload/Files/site_content/M0001/MoeLI-3.0.zip"; - sha256 = "0vpmm2qb429npng0aqkafwgs7cjibq8a3f7bbn9hysbm2lndwxwd"; + sha256 = "0b4kjdk0h0hx446swi0wzawia0mf16qh9b6v4h4nqg8qx0p2sd3c"; }; installPhase = '' From 739ab383a5f99fe7cd9bbc9ef8f0f6ff51e8c290 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 11 Jun 2022 08:29:31 +0100 Subject: [PATCH 4/4] coq_8_13.src, coq_8_14.src, coq_8_15.src: update hash change with fetchzip update fetchzip changed unpacking of UTF-8 files on glibc systems: https://github.com/NixOS/nixpkgs/pull/176253 As a result unpacked contents changed it's filenames. Closes: https://github.com/NixOS/nixpkgs/issues/176225 --- .../applications/science/logic/coq/default.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/science/logic/coq/default.nix b/pkgs/applications/science/logic/coq/default.nix index f91b336cbf6..bb92e2d7492 100644 --- a/pkgs/applications/science/logic/coq/default.nix +++ b/pkgs/applications/science/logic/coq/default.nix @@ -41,15 +41,15 @@ let "8.12.0".sha256 = "18dc7k0piv6v064zgdadpw6mkkxk7j663hb3svgj5236fihjr0cz"; "8.12.1".sha256 = "1rkcyjjrzcqw9xk93hsq0vvji4f8r5iq0f739mghk60bghkpnb7q"; "8.12.2".sha256 = "18gscfm039pqhq4msq01nraig5dm9ab98bjca94zldf8jvdv0x2n"; - "8.13.0".sha256 = "0sjbqmz6qcvnz0hv87xha80qbhvmmyd675wyc5z4rgr34j2l1ymd"; - "8.13.1".sha256 = "0xx2ns84mlip9bg2mkahy3pmc5zfcgrjxsviq9yijbzy1r95wf0n"; - "8.13.2".sha256 = "1884vbmwmqwn9ngibax6dhnqh4cc02l0s2ajc6jb1xgr0i60whjk"; - "8.14.0".sha256 = "04y2z0qyvag66zanfyc3f9agvmzbn4lsr0p1l7ck6yjhqx7vbm17"; - "8.14.1".sha256 = "0sx78pgx0qw8v7v2r32zzy3l161zipzq95iacda628girim7psnl"; - "8.15.0".sha256 = "sha256:1ma76wfrpfsl72yh10w1ys2a0vi0mdc2jc79kdc8nrmxkhpw1nxx"; - "8.15.1".sha256 = "sha256:1dsa04jzkx5pw69pmxn0l55q4w88lg6fvz7clbga0bazzsfnsgd6"; - "8.15.2".sha256 = "sha256:0gn8dz69scxnxaq6ycb3x34bjfk9wlp1y2xn8w69kg9fm4b6gkc7"; - "8.16+rc1".sha256 = "sha256-dU+E0Mz7MVntbQIeG9I59ANBaHaXXSrjCRdoqZ5TO60="; + "8.13.0".sha256 = "1l2c63vskp8kiyxiyi5rpgbmnv67ysn3y4lybd6nj0li5llibifi"; + "8.13.1".sha256 = "15drjcqhsgwqnv02bbidyhk316ypyhz1pxfz2gwsalci9svhkz0v"; + "8.13.2".sha256 = "14d4alp35hngvga9m7cfp5d1nl62xdj0nm4811f2jjblk86gxxk4"; + "8.14.0".sha256 = "0yxjx9kq9bfpk31dc1c6a0pz0827fz7jmrcwwd4n7dc07yi0arq8"; + "8.14.1".sha256 = "0xdqiabgm4lrm6d7lw544zd8xwb1cdcavsxvwwlqq6yid2rl2yli"; + "8.15.0".sha256 = "sha256:0q7jl3bn0d1v9cwdkxykw4frccww6wbh1p8hdrfqw489mkxmh5jh"; + "8.15.1".sha256 = "sha256:1janvmnk3czimp0j5qmnfwx6509vhpjc2q7lcza1bc6dm6kn8n42"; + "8.15.2".sha256 = "sha256:0qibbvzrhsvs6w3zpkhyclndp29jnr6bs9i5skjlpp431jdjjfqd"; + "8.16+rc1".sha256 = "sha256-hmZQ6rFIOZJwnAh23nKScJ3Nn+xqDRn5q2Tn82igpYE="; }; releaseRev = v: "V${v}"; fetched = import ../../../../build-support/coq/meta-fetch/default.nix