nix icon indicating copy to clipboard operation
nix copied to clipboard

nix-shell refers to `nix log`, an experimental command

Open Profpatsch opened this issue 3 years ago • 4 comments

Describe the bug

When a nix-shell build fails, a message containing a redacted log and “please use nix log appears, but I cannot use nix log without enabling experimental features.

Steps To Reproduce

> nix-shell -E 'with import <nixpkgs> {}; mkShell { buildDepends = [ (hello.overrideAttrs (old: { patchPhase = "false\n" + old.patchPhase or ""; })) ]; }'
this derivation will be built:
  /nix/store/6nb93y5syyb33k3sbjn2ldbqfk3zc1xl-hello-2.12.drv
building '/nix/store/6nb93y5syyb33k3sbjn2ldbqfk3zc1xl-hello-2.12.drv' on 'ssh://[email protected]'...
copying path '/nix/store/8nqv6kshb3vs5q5bs2k600xpj5bkavkc-hello-2.12.tar.gz' from 'https://cache.nixos.org'...
copying 0 paths...
unpacking sources
unpacking source archive /nix/store/8nqv6kshb3vs5q5bs2k600xpj5bkavkc-hello-2.12.tar.gz
source root is hello-2.12
setting SOURCE_DATE_EPOCH to timestamp 1643655444 of file hello-2.12/ChangeLog
patching sources
error: build of '/nix/store/6nb93y5syyb33k3sbjn2ldbqfk3zc1xl-hello-2.12.drv' on 'ssh://[email protected]' failed: error: builder for '/nix/store/6nb93y5syyb33k3sbjn2ldbqfk3zc1xl-hello-2.12.drv' failed with exit code 1;
              last 5 log lines:
              > unpacking sources
              > unpacking source archive /nix/store/8nqv6kshb3vs5q5bs2k600xpj5bkavkc-hello-2.12.tar.gz
              > source root is hello-2.12
              > setting SOURCE_DATE_EPOCH to timestamp 1643655444 of file hello-2.12/ChangeLog
              > patching sources
              For full logs, run 'nix log /nix/store/6nb93y5syyb33k3sbjn2ldbqfk3zc1xl-hello-2.12.drv'.
error: builder for '/nix/store/6nb93y5syyb33k3sbjn2ldbqfk3zc1xl-hello-2.12.drv' failed with exit code 1;
       last 6 log lines:
       > copying path '/nix/store/8nqv6kshb3vs5q5bs2k600xpj5bkavkc-hello-2.12.tar.gz' from 'https://cache.nixos.org'...
       > unpacking sources
       > unpacking source archive /nix/store/8nqv6kshb3vs5q5bs2k600xpj5bkavkc-hello-2.12.tar.gz
       > source root is hello-2.12
       > setting SOURCE_DATE_EPOCH to timestamp 1643655444 of file hello-2.12/ChangeLog
       > patching sources
       For full logs, run 'nix log /nix/store/6nb93y5syyb33k3sbjn2ldbqfk3zc1xl-hello-2.12.drv'.

> nix log
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

Expected behavior

Nix should show the full output or not require nix log, or nix log should not be experimental.

> nix-shell --version
nix-shell (Nix) 2.6.1

Profpatsch avatar Mar 11 '22 14:03 Profpatsch

It does show the full log, but prints the last lines again with the note to nix log which should be removed.

sternenseemann avatar Mar 11 '22 14:03 sternenseemann

It maybe does in this example, but it certainly doesn’t in a case where it happens after more than 6 log linse.

Profpatsch avatar Mar 11 '22 14:03 Profpatsch

Or rather, the logic is even more confused than that:

> nix-shell -E 'with import <nixpkgs> {}; mkShell { buildDepends = [ (hello.overrideAttrs (old: { installPhase = old.installPhase or "" + "\nfalse"; })) ]; }'

<SNIP>

SKIP: tests/greeting-2
PASS: tests/hello-1
PASS: tests/last-1
PASS: tests/operand-1
PASS: tests/traditional-1
============================================================================
Testsuite summary for GNU Hello 2.12.1-6fe9
============================================================================
# TOTAL: 7
# PASS:  6
# SKIP:  1
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[4]: Leaving directory '/build/hello-2.12'
make[3]: Leaving directory '/build/hello-2.12'
make[2]: Leaving directory '/build/hello-2.12'
make[1]: Leaving directory '/build/hello-2.12'
installing
error: build of '/nix/store/zqnlbpp2n9ar9wva56g1jczqf57a2g3k-hello-2.12.drv' on 'ssh://[email protected]' failed: error: builder for '/nix/store/zqnlbpp2n9ar9wva56g1jczqf57a2g3k-hello-2.12.drv' failed with exit code 1;
              last 10 log lines:
              > # XFAIL: 0
              > # FAIL:  0
              > # XPASS: 0
              > # ERROR: 0
              > ============================================================================
              > make[4]: Leaving directory '/build/hello-2.12'
              > make[3]: Leaving directory '/build/hello-2.12'
              > make[2]: Leaving directory '/build/hello-2.12'
              > make[1]: Leaving directory '/build/hello-2.12'
              > installing
              For full logs, run 'nix log /nix/store/zqnlbpp2n9ar9wva56g1jczqf57a2g3k-hello-2.12.drv'.
error: builder for '/nix/store/zqnlbpp2n9ar9wva56g1jczqf57a2g3k-hello-2.12.drv' failed with exit code 1;
       last 10 log lines:
       > # XFAIL: 0
       > # FAIL:  0
       > # XPASS: 0
       > # ERROR: 0
       > ============================================================================
       > make[4]: Leaving directory '/build/hello-2.12'
       > make[3]: Leaving directory '/build/hello-2.12'
       > make[2]: Leaving directory '/build/hello-2.12'
       > make[1]: Leaving directory '/build/hello-2.12'
       > installing
       For full logs, run 'nix log /nix/store/zqnlbpp2n9ar9wva56g1jczqf57a2g3k-hello-2.12.drv'.

Profpatsch avatar Mar 11 '22 14:03 Profpatsch

Yes, that was what I was referring to. The full log is printed as nix-shell does still print the build output as it happens.

sternenseemann avatar Mar 11 '22 14:03 sternenseemann