From 7166c00efcc4fd08d933556b2102111d41fae56c Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Mon, 16 Mar 2026 12:58:18 +0100 Subject: [PATCH] libexpr: print flake config warning to stderr Fixes #1155 Change-Id: Ie63f9200f7c06b1eec6c52518d6f523f6a6a6964 (cherry picked from commit f87d753987bf19553bab6e94db7356e80cdd8259) --- doc/manual/rl-next/libexpr-fix-stdout.md | 9 +++++++++ lix/libexpr/flake/config.cc | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 doc/manual/rl-next/libexpr-fix-stdout.md diff --git a/doc/manual/rl-next/libexpr-fix-stdout.md b/doc/manual/rl-next/libexpr-fix-stdout.md new file mode 100644 index 000000000..b52490972 --- /dev/null +++ b/doc/manual/rl-next/libexpr-fix-stdout.md @@ -0,0 +1,9 @@ +--- +synopsis: "flake config warnings are now printed to stderr" +issues: [1155] +cls: [5379] +category: "Fixes" +credits: [lheckemann] +--- + +The settings listed in a flake-config confirmation prompt are now printed to stderr rather than stdout, which allows `nix print-dev-env` to emit valid bash again even in the presence of untrusted settings. diff --git a/lix/libexpr/flake/config.cc b/lix/libexpr/flake/config.cc index fa32c747a..6d66c6fac 100644 --- a/lix/libexpr/flake/config.cc +++ b/lix/libexpr/flake/config.cc @@ -35,12 +35,14 @@ static bool batchAskForSetting( TrustedList & trustedList, std::map & untrustedSettings) { - printWarning("The following settings require your decision:"); + std::string warning("The following settings require your decision:"); for (const auto & [name, valueS] : untrustedSettings) { // FIXME: filter ANSI escapes, newlines, \r, etc. - logger->cout("- %s = %s", name, valueS); + warning += fmt("\n- %s = %s", name, valueS); } + printWarning("%s", warning); + auto reply = logger ->ask( fmt("Do you want to allow configuration settings to be applied?\nThis may allow the "