bintools-wrapper, cc-wrapper: avoid invalid export of 'expand-response-params'

POSIX sh (and `bash`) impose a restriction on environment variable name
format and disallow hypheps in the names. Normally it's not a problem
as nothing usually tries to refer nyphenated names.

One exception is `nix develop` (https://github.com/NixOS/nix/issues/6848):

    $ nix develop -f. gcc -L
    gcc-wrapper> ...-get-env.sh: line 70: expand-response-params: bad substitution

Note that bash usually uses explicitly created `expandResponseParams`
variant of the same variable.

To work the problem around let's avoid environment variable export and move
it to `passthru` for `cc` (used ina  few places) and remove it completely for
`binutils` (does not seem to be used at all).
main
Sergei Trofimovich 2 years ago
parent 24ae20a455
commit 549e08c8e8
  1. 2
      pkgs/build-support/bintools-wrapper/default.nix
  2. 3
      pkgs/build-support/cc-wrapper/default.nix

@ -365,7 +365,7 @@ stdenv.mkDerivation {
##
+ extraBuildCommands;
inherit dynamicLinker expand-response-params;
inherit dynamicLinker;
# for substitution in utils.bash
expandResponseParams = "${expand-response-params}/bin/expand-response-params";

@ -157,6 +157,8 @@ stdenv.mkDerivation {
'(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)}))
'';
inherit expand-response-params;
inherit nixSupport;
};
@ -540,7 +542,6 @@ stdenv.mkDerivation {
(name: value: "echo ${toString value} >> $out/nix-support/${name}")
nixSupport);
inherit expand-response-params;
# for substitution in utils.bash
expandResponseParams = "${expand-response-params}/bin/expand-response-params";

Loading…
Cancel
Save