mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-16 15:17:18 +02:00
nix shell: Test that store paths cannot link outside of the store
This commit is contained in:
parent
9d50f57fa3
commit
26a4688a86
2 changed files with 11 additions and 0 deletions
|
@ -32,6 +32,14 @@ rec {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
forbidden-symlink = mkDerivation {
|
||||||
|
name = "forbidden-symlink";
|
||||||
|
buildCommand =
|
||||||
|
''
|
||||||
|
ln -s /tmp/foo/bar $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
salve-mundi = mkDerivation {
|
salve-mundi = mkDerivation {
|
||||||
name = "salve-mundi";
|
name = "salve-mundi";
|
||||||
outputs = [ "out" ];
|
outputs = [ "out" ];
|
||||||
|
|
|
@ -13,6 +13,9 @@ nix shell -f shell-hello.nix 'hello^*' -c hello2 | grep 'Hello2'
|
||||||
# Test output paths that are a symlink.
|
# Test output paths that are a symlink.
|
||||||
nix shell -f shell-hello.nix hello-symlink -c hello | grep 'Hello World'
|
nix shell -f shell-hello.nix hello-symlink -c hello | grep 'Hello World'
|
||||||
|
|
||||||
|
# Test that symlinks outside of the store don't work.
|
||||||
|
expect 1 nix shell -f shell-hello.nix forbidden-symlink -c hello 2>&1 | grepQuiet "is not in the Nix store"
|
||||||
|
|
||||||
if isDaemonNewer "2.20.0pre20231220"; then
|
if isDaemonNewer "2.20.0pre20231220"; then
|
||||||
# Test that command line attribute ordering is reflected in the PATH
|
# Test that command line attribute ordering is reflected in the PATH
|
||||||
# https://github.com/NixOS/nix/issues/7905
|
# https://github.com/NixOS/nix/issues/7905
|
||||||
|
|
Loading…
Add table
Reference in a new issue