Skip to content

Post-builder checks' failure reason is not logged #13509

@roberth

Description

@roberth

Describe the bug

When for example an output is not written, this results in an exception, which is not written to the store's build log; only to the CLI.
Nonetheless, the CLI claims that nix log foo.drv has the full log.

Steps To Reproduce

[nix-shell:~/src/nixpkgs-master]$ nix build --expr 'with import ./. {}; runCommand "test" { } "echo hi"' --impure
error: build of '/nix/store/pmjy7fp4v6jjb1v06fasrzgs4sg2rvam-test.drv' on 'ssh://agent-2' failed: builder for '/nix/store/pmjy7fp4v6jjb1v06fasrzgs4sg2rvam-test.drv' failed to produce output path for output 'out' at '/nix/store/pmjy7fp4v6jjb1v06fasrzgs4sg2rvam-test.drv.chroot/root/nix/store/3q3hxld9r4i7x4xwp5m8hn7kbln76c2r-test'
error: Cannot build '/nix/store/pmjy7fp4v6jjb1v06fasrzgs4sg2rvam-test.drv'.
       Reason: builder failed with exit code 1.
       Output paths:
         /nix/store/3q3hxld9r4i7x4xwp5m8hn7kbln76c2r-test
       Last 1 log lines:
       > hi
       For full logs, run:
         nix log /nix/store/pmjy7fp4v6jjb1v06fasrzgs4sg2rvam-test.drv

[nix-shell:~/src/nixpkgs-master]$ nix log --expr 'with import ./. {}; runCommand "test" { } "echo hi"' --impure
hi

Note also Reason: builder failed with exit code 1., which is also false, but I believe I've already created an issue for that.
It probably originates from the internal-ish build hook.

Expected behavior

Append the reason for the build failure to the store's build log file.
It could be logged to the CLI as well, if expedient, but the CLI will show the exception anyway, so technically it'd be duplicate logging.

Metadata

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugderivation-buildThe process of building an individual derivation (see also sandbox label)storeIssues and pull requests concerning the Nix store

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions