TunnelLogger never reports ->isVerbose() == true #1124
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#1124
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
Every
loggerhas aisVerbose()method which is (as far as I can tell) used for determining whether to print the last 20 or so log lines when a build fails. The idea is to not print any log output if Nix has already been printing them as they happen which I agree with (it is pretty annoying if the issue is not apparent in the 20 log lines and you have scroll up the same 20 lines again since they were printed twice).if (!logger->isVerbose() && !logTail.empty()) {msg += fmt(";\nlast %d log lines:\n", logTail.size());for (auto & line : logTail) {msg += "> ";msg += line;msg += "\n";}auto nixLogCommand =experimentalFeatureSettings.isEnabled(Xp::NixCommand) ? "nix log" : "nix-store -l";msg +=fmt("For full logs, run:\n\t" ANSI_BOLD "%s %s" ANSI_NORMAL "",nixLogCommand,worker.store.printStorePath(drvPath));}The issue turns out to be the following: The default method for
Loggerreportsfalsealways.SimpleLoggerchanges this and returnsprintBuildLogswhich is what we want. Hence, everything works as expected when using Nix in single user mode / opening the store directly.When using the daemon,
buildErrorContentsis executed by the daemon which usesTunnelLoggerinstead ofSimpleLoggerfor obvious reasons. That one doesn't implement a customisVerbose()method.Proposed solution
Unfortunately, the daemon does not seem to know whether the client wants to print logs or not at the moment. Given that
isVerbose()only seems to control this aspect of the whole machinery, my proposal would be the following:isVerbose()todoesPrintBuildLogsor something.printBuildLogsa proper client setting and report it to the daemon, so it can actually properly use that information.I'd be happy to implement that myself (I've already been trying at it), but wanted to hear some opinions on this first. I may be missing something since how this all works is pretty weird. I also get the impression that the whole way logging is weird up could use some refactoring, so maybe there are already some plans in place for that?
Steps To Reproduce
nix-buildor using--log-format raw. You'll see the last 20 log lines being printedsudo <command> --store /. You'll see everything working as expected.nix --versionoutputHappens on
mainthere's a cl for this here. we don't agree that this is a good idea because the last n lines are only truly duplicated if no other derivations were being built and producing output at the time; this is not a huge issue for the nix3 cli (since each log line is prefixed with the derivation name), but the nix2 cli does suffer greatly. for this reason we also think that the code you quoted is actually wrong and should not be inspecting
isVerboseto print the log tail but do it for all failures :/This issue was mentioned on Gerrit on the following CLs: