From a5d02bcdf996b8907930b28c1d3883766e8ccece Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Tue, 3 Dec 2024 20:38:41 +0100 Subject: [PATCH] libcmd: make a back-compat hack more robust otherwise eval fails if getEvalState runs before parseInstallables runs. Change-Id: Ia0d66dd6297212f7835c4a9b2db0fb4d9e4c9b9d --- lix/libcmd/installables.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lix/libcmd/installables.cc b/lix/libcmd/installables.cc index fea944f71..bf34a1169 100644 --- a/lix/libcmd/installables.cc +++ b/lix/libcmd/installables.cc @@ -214,6 +214,8 @@ void SourceExprCommand::completeInstallable(AddCompletions & completions, std::s evalSettings.pureEval.override(false); auto state = getEvalState(); + state->paths.allowedPaths.reset(); + Expr & e = state->parseExprFromFile( resolveExprPath(state->paths.checkSourcePath(lookupFileArg(*state, *file))) ); @@ -431,7 +433,10 @@ Installables SourceExprCommand::parseInstallables( throw UsageError("'--file' and '--expr' are exclusive"); // FIXME: backward compatibility hack - if (file) evalSettings.pureEval.override(false); + if (file) { + evalSettings.pureEval.override(false); + getEvalState()->paths.allowedPaths.reset(); + } auto state = getEvalState(); auto vFile = state->mem.allocValue();