mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
php: fix infinite recursion with overrideAttrs
This commit is contained in:
@@ -399,9 +399,15 @@ let
|
||||
newPhpAttrsOverrides = lib.composeExtensions (lib.toExtension phpAttrsOverrides) (
|
||||
lib.toExtension f
|
||||
);
|
||||
php = generic (args // { phpAttrsOverrides = newPhpAttrsOverrides; });
|
||||
phpOverridden = finalAttrs.overrideAttrs f;
|
||||
in
|
||||
php;
|
||||
phpOverridden
|
||||
// {
|
||||
passthru = phpOverridden.passthru // {
|
||||
buildEnv = mkBuildEnv { phpAttrsOverrides = newPhpAttrsOverrides; } [ ];
|
||||
withExtensions = mkWithExtensions { phpAttrsOverrides = newPhpAttrsOverrides; } [ ];
|
||||
};
|
||||
};
|
||||
inherit ztsSupport;
|
||||
|
||||
services.default = {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
lib,
|
||||
php,
|
||||
runCommand,
|
||||
stdenv,
|
||||
stdenvAdapters,
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -96,6 +98,26 @@ in
|
||||
${check (builtins.match ".*oAs-second.*" customPhp.postInstall != null)}
|
||||
'';
|
||||
|
||||
# Regression test for https://github.com/NixOS/nixpkgs/issues/509863:
|
||||
# wrapping php's stdenv with an adapter that uses `extendMkDerivationArgs`
|
||||
# (e.g. `keepDebugInfo`) used to trigger an infinite recursion via the
|
||||
# custom `passthru.overrideAttrs` defined for unwrapped php. Forcing the
|
||||
# derivation here would stack-overflow before the fix; checking
|
||||
# `dontStrip` also confirms the adapter actually applied.
|
||||
stdenvAdapter-keepDebugInfo-does-not-recurse =
|
||||
let
|
||||
customPhp = php.override {
|
||||
stdenv = stdenvAdapters.keepDebugInfo stdenv;
|
||||
};
|
||||
in
|
||||
runTest "php-test-stdenvAdapter-keepDebugInfo-does-not-recurse" ''
|
||||
checking "if the override evaluates without infinite recursion"
|
||||
${check (builtins.isString customPhp.unwrapped.drvPath)}
|
||||
|
||||
checking "if keepDebugInfo's dontStrip propagated to the unwrapped derivation"
|
||||
${check (customPhp.unwrapped.dontStrip or false)}
|
||||
'';
|
||||
|
||||
wrapped-overrideAttrs-stacks =
|
||||
let
|
||||
customPhp = lib.pipe php [
|
||||
|
||||
Reference in New Issue
Block a user