From ac316857f4d3be490266a9ff0e806f9281549391 Mon Sep 17 00:00:00 2001 From: Alex David Date: Mon, 21 Jul 2025 20:19:50 -0700 Subject: [PATCH] Allow unset readonly-paths-from-var variable --- combinators.nix | 2 +- tests/test-cases.nix | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/combinators.nix b/combinators.nix index 3b4aa52..52783e9 100644 --- a/combinators.nix +++ b/combinators.nix @@ -510,7 +510,7 @@ P="$(realpath "$DIR")" RUNTIME_ARGS+=(--ro-bind "$P" "$P") fi - done <<< "${"$"}${var}" + done <<< "''${${var}-}" '') ; }; diff --git a/tests/test-cases.nix b/tests/test-cases.nix index fb8a289..7b044d2 100644 --- a/tests/test-cases.nix +++ b/tests/test-cases.nix @@ -88,6 +88,11 @@ in { ) ]; + "combinators/readonly-from-path-var doesn't require the var to be set" = + jail "test" (sh "true") (c: [ + (c.readonly-paths-from-var "THIS_VAR_IS_NOT_SET" ":") + ]); + "combinators/set-argv" = assertStdout (jail "test" (sh "printf '1=%s,2=%s,3=%s' \"$@\"") (c: [ (c.set-argv [ "foo" "bar baz" "foo>'bar'" ])