Skip to content

lib.warn: Add NIX_ABORT_ON_WARN for call traces#140763

Merged
roberth merged 1 commit intoNixOS:masterfrom
hercules-ci:abort-on-warn
Oct 13, 2021
Merged

lib.warn: Add NIX_ABORT_ON_WARN for call traces#140763
roberth merged 1 commit intoNixOS:masterfrom
hercules-ci:abort-on-warn

Conversation

@roberth
Copy link
Member

@roberth roberth commented Oct 6, 2021

Motivation for this change

Finding the cause of a warning isn't always easy.
Printing a stack trace on every builtins.trace isn't feasible in Nix itself, so this is the next best thing, even if you can only find the first warning.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Oct 6, 2021
lib/trivial.nix Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't behave exactly like builtins.trace, because this function requires a string, whereas builtins.trace works with arbitrary things to trace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've clarified it, but left out the color, because we may want to change that to match Nix, which is switching to purple last time I checked.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a great idea to implement something like this, I'd have liked this a couple times before

@infinisil
Copy link
Member

Sounds good to merge after a squash

@roberth roberth merged commit a541ce1 into NixOS:master Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants