From 26e8e3caac19acf51217c9632e16a70cc0e90902 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 11 Oct 2025 21:59:56 +0200 Subject: [PATCH] libutil: allow builders to create all activity types this restriction was added in 4af2611bd105f365e568069463b1700d141dd0a8 and extended later. it makes little sense to allow *one* activity type specifically and drop all others on the floor, especially since broken builders can create transfer activities with ids that would be used by other, "real" activities. the only thing achieved here is to drop logs written in json format in the build sandbox, which does not help much. we may revisit this restriction later during other log-related rework. Change-Id: I8bda494083877b71a2f958470fa52380f6ec4968 --- lix/libstore/build/derivation-goal.cc | 6 ++++-- lix/libutil/logging.cc | 21 +++++++++------------ lix/libutil/logging.hh | 6 ++---- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lix/libstore/build/derivation-goal.cc b/lix/libstore/build/derivation-goal.cc index 27bfef0d1..cfd0b34eb 100644 --- a/lix/libstore/build/derivation-goal.cc +++ b/lix/libstore/build/derivation-goal.cc @@ -1239,7 +1239,7 @@ try { }); if (const auto state = handleJSONLogMessage( - currentLogLine, *act, builderActivities, "the derivation builder", false + currentLogLine, *act, builderActivities, "the derivation builder" )) { return *state; @@ -1323,7 +1323,9 @@ try { if (c == '\n') { auto json = parseJSONMessage(currentHookLine, "the derivation builder"); if (json) { - auto s = handleJSONLogMessage(*json, worker.act, hook->activities, "the derivation builder", true); + auto s = handleJSONLogMessage( + *json, worker.act, hook->activities, "the derivation builder" + ); // ensure that logs from a builder using `ssh-ng://` as protocol // are also available to `nix log`. if (s && logSink) { diff --git a/lix/libutil/logging.cc b/lix/libutil/logging.cc index d189f4119..846b386bf 100644 --- a/lix/libutil/logging.cc +++ b/lix/libutil/logging.cc @@ -310,8 +310,7 @@ std::optional handleJSONLogMessage( JSON & json, const Activity & act, std::map & activities, - std::string_view source, - bool trusted + std::string_view source ) { try { @@ -319,13 +318,12 @@ std::optional handleJSONLogMessage( if (action == "start") { auto type = (ActivityType) json["type"]; - if (trusted || type == actFileTransfer) - activities.emplace( - json["id"], - act.addChild( - (Verbosity) json["level"], type, json["text"], getFields(json["fields"]) - ) - ); + activities.emplace( + json["id"], + act.addChild( + (Verbosity) json["level"], type, json["text"], getFields(json["fields"]) + ) + ); } else if (action == "stop") @@ -360,8 +358,7 @@ std::optional handleJSONLogMessage( const std::string & msg, const Activity & act, std::map & activities, - std::string_view source, - bool trusted + std::string_view source ) { auto json = parseJSONMessage(msg, source); @@ -369,7 +366,7 @@ std::optional handleJSONLogMessage( return std::nullopt; } - return handleJSONLogMessage(*json, act, activities, source, trusted); + return handleJSONLogMessage(*json, act, activities, source); } Activity::~Activity() diff --git a/lix/libutil/logging.hh b/lix/libutil/logging.hh index e95d315b2..7fd9160c1 100644 --- a/lix/libutil/logging.hh +++ b/lix/libutil/logging.hh @@ -422,8 +422,7 @@ std::optional handleJSONLogMessage( JSON & json, const Activity & act, std::map & activities, - std::string_view source, - bool trusted + std::string_view source ); /** @@ -434,7 +433,6 @@ std::optional handleJSONLogMessage( const std::string & msg, const Activity & act, std::map & activities, - std::string_view source, - bool trusted + std::string_view source ); }