From 84fbc9d6442db58409b3eb8db05200cf2a54189f Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 13 Mar 2025 18:24:09 +0100 Subject: [PATCH] Repl: error out if :log is called without a derivation The repl crashes with an assertion error at lix/libutil/file-system.cc:45 if you run ':log' without any derivation, so I added a check to error out gracefully Change-Id: I7af70040f884e905f0514ea9883b2380fe148f15 --- lix/libcmd/repl.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lix/libcmd/repl.cc b/lix/libcmd/repl.cc index 203f9414d..899fdc4a8 100644 --- a/lix/libcmd/repl.cc +++ b/lix/libcmd/repl.cc @@ -713,6 +713,8 @@ ProcessLineResult NixRepl::processLine(std::string line) } else if (command == ":log") { + if (arg.empty()) + throw Error("cannot use ':log' without a specifying a derivation"); StorePath drvPath = ([&] { auto maybeDrvPath = evaluator.store->maybeParseStorePath(arg); if (maybeDrvPath && maybeDrvPath->isDerivation()) {