1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 19:03:16 +02:00

For backward compatibility, allow appending non-root paths to the root FS

This makes

  let foo = "foo"; in /${foo}

work again.
This commit is contained in:
Eelco Dolstra 2022-12-14 13:21:54 +01:00
parent 12c554acd4
commit a322306247

View file

@ -1998,7 +1998,7 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
} else if (firstType == nPath) { } else if (firstType == nPath) {
if (!first) { if (!first) {
auto part = state.coerceToString(i_pos, *vTmp, context, false, false); auto part = state.coerceToString(i_pos, *vTmp, context, false, false);
if (sSize <= 1 && !hasPrefix(*part, "/")) if (sSize <= 1 && !hasPrefix(*part, "/") && accessor != state.rootFS.get_ptr())
state.throwEvalError(i_pos, state.throwEvalError(i_pos,
"cannot append non-absolute path '%1%' to '%2%' (hint: change it to '/%1%')", "cannot append non-absolute path '%1%' to '%2%' (hint: change it to '/%1%')",
(std::string) *part, accessor->root().to_string(), (std::string) *part, accessor->root().to_string(),