version.json: begin the 2.96 series
Change-Id: I21c37e20fc2e5786367aa9b6e5ebb7ba12eb8b6c
This commit is contained in:
committed by
eldritch horrors
parent
c08f2336d0
commit
2cea406121
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
synopsis: "Shadowing internal files through the Nix search path is now an error"
|
||||||
|
issues: [998]
|
||||||
|
cls: [4632, 5370]
|
||||||
|
category: "Breaking Changes"
|
||||||
|
credits: [thubrecht, jade, horrors]
|
||||||
|
---
|
||||||
|
|
||||||
|
As Lix uses the path `<nix/fetchurl.nix>` for bootstrapping purposes, the ability to shadow it by adding `nix=/some/path` (or `/other/path` that contains a `nix` directory) to the search path is not desirable.
|
||||||
|
|
||||||
|
Lix 2.95 deprecated this behavior with a warning, Lix 2.96 now turns it into a hard error if the `nix-path-shadow` deprecated feature isn't enabled. This deprecated feature is slated to be removed in Lix 2.98.
|
||||||
+9
-12
@@ -297,19 +297,19 @@ EvalPaths::EvalPaths(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIX_MAJOR >= 3 || (LIX_MAJOR == 2 && LIX_MINOR >= 96)
|
#if LIX_MAJOR >= 3 || (LIX_MAJOR == 2 && LIX_MINOR >= 98)
|
||||||
#warning \
|
#warning \
|
||||||
"The feature nix-path-shadow was deprecated in 2.95 with a warning, which needs to be turned into an error in 2.96"
|
"The feature nix-path-shadow was deprecated in 2.95 with a warning, error in 2.96, and we should consider removing the bypass in 2.98"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!featureSettings.isEnabled(DeprecatedFeature::NixPathShadow)) {
|
if (!featureSettings.isEnabled(DeprecatedFeature::NixPathShadow)) {
|
||||||
for (auto & [prefix, path] : searchPath_.elements) {
|
for (auto & [prefix, path] : searchPath_.elements) {
|
||||||
// Match on the 'nix' prefix
|
// Match on the 'nix' prefix
|
||||||
if (prefix.s == "nix") {
|
if (prefix.s == "nix") {
|
||||||
logWarning(
|
throw EvalError(HintFmt(
|
||||||
{.msg = HintFmt(
|
|
||||||
"The prefix '%s' is reserved for internal use by Lix in the Nix search "
|
"The prefix '%s' is reserved for internal use by Lix in the Nix search "
|
||||||
"path, its usage is deprecated and will be forbidden in the future.\n"
|
"path, its usage is deprecated and will be forbidden in the future.\n"
|
||||||
"Use %s to silence this warning.\n"
|
"Use %s to silence this error.\n"
|
||||||
"This is due to adding '%s=%s' in the Nix search path, either through the "
|
"This is due to adding '%s=%s' in the Nix search path, either through the "
|
||||||
"environment variable '%s' or by passing the flag %s to the nix "
|
"environment variable '%s' or by passing the flag %s to the nix "
|
||||||
"invocation.",
|
"invocation.",
|
||||||
@@ -319,8 +319,7 @@ EvalPaths::EvalPaths(
|
|||||||
path.s,
|
path.s,
|
||||||
"NIX_PATH",
|
"NIX_PATH",
|
||||||
"-I"
|
"-I"
|
||||||
)}
|
));
|
||||||
);
|
|
||||||
} else
|
} else
|
||||||
// Match prefixless paths that contain a `nix` directory
|
// Match prefixless paths that contain a `nix` directory
|
||||||
if (auto res =
|
if (auto res =
|
||||||
@@ -333,11 +332,10 @@ EvalPaths::EvalPaths(
|
|||||||
});
|
});
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
logWarning(
|
throw EvalError(HintFmt(
|
||||||
{.msg = HintFmt(
|
|
||||||
"Shadowing '%s' by configuring the nix-path is deprecated and "
|
"Shadowing '%s' by configuring the nix-path is deprecated and "
|
||||||
"will be forbidden in the future.\n"
|
"will be forbidden in the future.\n"
|
||||||
"Use %s to silence this warning.\n"
|
"Use %s to silence this error.\n"
|
||||||
"This is due to adding '%s' to the nix-path without a prefix, "
|
"This is due to adding '%s' to the nix-path without a prefix, "
|
||||||
"either by passing the flag '-I %s' to the nix invocation or by "
|
"either by passing the flag '-I %s' to the nix invocation or by "
|
||||||
"adding this path to the environment variable '%s'.",
|
"adding this path to the environment variable '%s'.",
|
||||||
@@ -346,8 +344,7 @@ EvalPaths::EvalPaths(
|
|||||||
path.s,
|
path.s,
|
||||||
path.s,
|
path.s,
|
||||||
"NIX_PATH"
|
"NIX_PATH"
|
||||||
)}
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
warning: The prefix 'nix' is reserved for internal use by Lix in the Nix search path, its usage is deprecated and will be forbidden in the future.
|
error: The prefix 'nix' is reserved for internal use by Lix in the Nix search path, its usage is deprecated and will be forbidden in the future.
|
||||||
Use --extra-deprecated-features nix-path-shadow to silence this warning.
|
Use --extra-deprecated-features nix-path-shadow to silence this error.
|
||||||
This is due to adding 'nix=nix-shadow' in the Nix search path, either through the environment variable 'NIX_PATH' or by passing the flag -I to the nix invocation.
|
This is due to adding 'nix=nix-shadow' in the Nix search path, either through the environment variable 'NIX_PATH' or by passing the flag -I to the nix invocation.
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
warning: Shadowing '<nix/...>' by configuring the nix-path is deprecated and will be forbidden in the future.
|
error: Shadowing '<nix/...>' by configuring the nix-path is deprecated and will be forbidden in the future.
|
||||||
Use --extra-deprecated-features nix-path-shadow to silence this warning.
|
Use --extra-deprecated-features nix-path-shadow to silence this error.
|
||||||
This is due to adding 'nix-shadow' to the nix-path without a prefix, either by passing the flag '-I nix-shadow' to the nix invocation or by adding this path to the environment variable 'NIX_PATH'.
|
This is due to adding 'nix-shadow' to the nix-path without a prefix, either by passing the flag '-I nix-shadow' to the nix invocation or by adding this path to the environment variable 'NIX_PATH'.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from lang.test_lang import test_eval_okay as nix_eval
|
from lang.test_lang import test_eval_fail as nix_eval_fail, test_eval_okay as nix_eval_okay
|
||||||
from testlib.fixtures.file_helper import AssetSymlink, CopyFile, CopyTree, with_files
|
from testlib.fixtures.file_helper import AssetSymlink, CopyFile, CopyTree, with_files
|
||||||
from testlib.fixtures.nix import Nix
|
from testlib.fixtures.nix import Nix
|
||||||
from testlib.fixtures.snapshot import Snapshot
|
from testlib.fixtures.snapshot import Snapshot
|
||||||
@@ -21,7 +21,7 @@ from testlib.fixtures.snapshot import Snapshot
|
|||||||
)
|
)
|
||||||
def test_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
|
def test_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
|
||||||
nix.env.set_env("NIX_PATH", "dir3:dir4")
|
nix.env.set_env("NIX_PATH", "dir3:dir4")
|
||||||
nix_eval(
|
nix_eval_okay(
|
||||||
files,
|
files,
|
||||||
nix,
|
nix,
|
||||||
[
|
[
|
||||||
@@ -43,12 +43,26 @@ def test_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot])
|
|||||||
"nix-shadow": CopyTree("nix-shadow"),
|
"nix-shadow": CopyTree("nix-shadow"),
|
||||||
"in.nix": CopyFile("in-fetchurl.nix"),
|
"in.nix": CopyFile("in-fetchurl.nix"),
|
||||||
"out.exp": AssetSymlink("eval-okay-prefixed.out.exp"),
|
"out.exp": AssetSymlink("eval-okay-prefixed.out.exp"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
def test_prefixed_search_path_deprecated(
|
||||||
|
files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]
|
||||||
|
):
|
||||||
|
nix.env.set_env("NIX_PATH", "nix=nix-shadow")
|
||||||
|
nix.settings.add_dp_feature("nix-path-shadow")
|
||||||
|
nix_eval_okay(files, nix, [], snapshot)
|
||||||
|
|
||||||
|
|
||||||
|
@with_files(
|
||||||
|
{
|
||||||
|
"nix-shadow": CopyTree("nix-shadow"),
|
||||||
|
"in.nix": CopyFile("in-fetchurl.nix"),
|
||||||
"err.exp": AssetSymlink("eval-okay-prefixed.err.exp"),
|
"err.exp": AssetSymlink("eval-okay-prefixed.err.exp"),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
def test_prefixed_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
|
def test_prefixed_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
|
||||||
nix.env.set_env("NIX_PATH", "nix=nix-shadow")
|
nix.env.set_env("NIX_PATH", "nix=nix-shadow")
|
||||||
nix_eval(files, nix, [], snapshot)
|
nix_eval_fail(files, nix, [], snapshot)
|
||||||
|
|
||||||
|
|
||||||
@with_files(
|
@with_files(
|
||||||
@@ -56,11 +70,24 @@ def test_prefixed_search_path(files: Path, nix: Nix, snapshot: Callable[[str], S
|
|||||||
"nix-shadow": CopyTree("nix-shadow"),
|
"nix-shadow": CopyTree("nix-shadow"),
|
||||||
"in.nix": CopyFile("in-fetchurl.nix"),
|
"in.nix": CopyFile("in-fetchurl.nix"),
|
||||||
"out.exp": AssetSymlink("eval-okay-prefixless.out.exp"),
|
"out.exp": AssetSymlink("eval-okay-prefixless.out.exp"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
def test_prefixless_search_path_deprecated(
|
||||||
|
files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]
|
||||||
|
):
|
||||||
|
nix.settings.add_dp_feature("nix-path-shadow")
|
||||||
|
nix_eval_okay(files, nix, ["-I", "nix-shadow"], snapshot)
|
||||||
|
|
||||||
|
|
||||||
|
@with_files(
|
||||||
|
{
|
||||||
|
"nix-shadow": CopyTree("nix-shadow"),
|
||||||
|
"in.nix": CopyFile("in-fetchurl.nix"),
|
||||||
"err.exp": AssetSymlink("eval-okay-prefixless.err.exp"),
|
"err.exp": AssetSymlink("eval-okay-prefixless.err.exp"),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
def test_prefixless_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
|
def test_prefixless_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
|
||||||
nix_eval(files, nix, ["-I", "nix-shadow"], snapshot)
|
nix_eval_fail(files, nix, ["-I", "nix-shadow"], snapshot)
|
||||||
|
|
||||||
|
|
||||||
@with_files(
|
@with_files(
|
||||||
@@ -71,4 +98,4 @@ def test_prefixless_search_path(files: Path, nix: Nix, snapshot: Callable[[str],
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
def test_empty_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
|
def test_empty_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
|
||||||
nix_eval(files, nix, [], snapshot)
|
nix_eval_okay(files, nix, [], snapshot)
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "2.95.0",
|
"version": "2.96.0-dev",
|
||||||
"official_release": false,
|
"official_release": false,
|
||||||
"release_name": "Kakigōri"
|
"release_name": "TBD"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user