NIX_LOG_FD messages without any fields crash Lix #544

Open
opened 2024-10-11 14:42:50 +00:00 by lheckemann · 1 comment
Member

Describe the bug

Writing @nix {} to NIX_LOG_FD in a derivation crashes Lix.

Steps To Reproduce

$ nix-build -E 'with import <nixpkgs> {}; runCommand "foo" {} "echo @nix {} >&$NIX_LOG_FD; touch $out"'
this derivation will be built:
  /nix/store/i09fa3v3gjck96s222nnnbpsirsggwnb-foo.drv
building '/nix/store/i09fa3v3gjck96s222nnnbpsirsggwnb-foo.drv'...
Lix crashed. This is a bug. We would appreciate if you report it along with what caused it at https://git.lix.systems/lix-project/lix/issues with the following information included:

Exception: kj::ExceptionImpl: (unknown):-1: failed: std::exception: [json.exception.type_error.302] type must be string, but is null
stack: 7fe317b6cadd
Stack trace:
 0# nix::printStackTrace() in /nix/store/wvqzls2g8dwr6fprw50j3d1adhdzdls1-lix-2.92.0-dev-pre20241008-4ea8c9d/lib/liblixutil.so
 1# 0x00007FE3182AB516 in /nix/store/wvqzls2g8dwr6fprw50j3d1adhdzdls1-lix-2.92.0-dev-pre20241008-4ea8c9d/lib/liblixmain.so
 2# 0x00007FE3170BC21A in /nix/store/swcl0ynnia5c57i6qfdcrqa72j7877mg-gcc-13.2.0-lib/lib/libstdc++.so.6
 3# 0x00007FE3170BC285 in /nix/store/swcl0ynnia5c57i6qfdcrqa72j7877mg-gcc-13.2.0-lib/lib/libstdc++.so.6
 4# nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) in /nix/store/wvqzls2g8dwr6fprw50j3d1adhdzdls1-lix-2.92.0-dev-pre20241008-4ea8c9d/lib/liblixmain.so
 5# 0x00005650D9D0C99B in nix-build
 6# 0x00007FE316E3D10E in /nix/store/c10zhkbp6jmyh0xc5kd123ga8yy2p4hk-glibc-2.39-52/lib/libc.so.6
 7# __libc_start_main in /nix/store/c10zhkbp6jmyh0xc5kd123ga8yy2p4hk-glibc-2.39-52/lib/libc.so.6
 8# 0x00005650D9C67395 in nix-build

Aborted

Expected behavior

The build continues, potentially with a warning. Maybe it should also fail the build, but cleanly?

nix --version output

nix (Lix, like Nix) 2.92.0-dev-pre20241008-4ea8c9d

## Describe the bug Writing `@nix {}` to NIX_LOG_FD in a derivation crashes Lix. ## Steps To Reproduce ``` $ nix-build -E 'with import <nixpkgs> {}; runCommand "foo" {} "echo @nix {} >&$NIX_LOG_FD; touch $out"' this derivation will be built: /nix/store/i09fa3v3gjck96s222nnnbpsirsggwnb-foo.drv building '/nix/store/i09fa3v3gjck96s222nnnbpsirsggwnb-foo.drv'... Lix crashed. This is a bug. We would appreciate if you report it along with what caused it at https://git.lix.systems/lix-project/lix/issues with the following information included: Exception: kj::ExceptionImpl: (unknown):-1: failed: std::exception: [json.exception.type_error.302] type must be string, but is null stack: 7fe317b6cadd Stack trace: 0# nix::printStackTrace() in /nix/store/wvqzls2g8dwr6fprw50j3d1adhdzdls1-lix-2.92.0-dev-pre20241008-4ea8c9d/lib/liblixutil.so 1# 0x00007FE3182AB516 in /nix/store/wvqzls2g8dwr6fprw50j3d1adhdzdls1-lix-2.92.0-dev-pre20241008-4ea8c9d/lib/liblixmain.so 2# 0x00007FE3170BC21A in /nix/store/swcl0ynnia5c57i6qfdcrqa72j7877mg-gcc-13.2.0-lib/lib/libstdc++.so.6 3# 0x00007FE3170BC285 in /nix/store/swcl0ynnia5c57i6qfdcrqa72j7877mg-gcc-13.2.0-lib/lib/libstdc++.so.6 4# nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) in /nix/store/wvqzls2g8dwr6fprw50j3d1adhdzdls1-lix-2.92.0-dev-pre20241008-4ea8c9d/lib/liblixmain.so 5# 0x00005650D9D0C99B in nix-build 6# 0x00007FE316E3D10E in /nix/store/c10zhkbp6jmyh0xc5kd123ga8yy2p4hk-glibc-2.39-52/lib/libc.so.6 7# __libc_start_main in /nix/store/c10zhkbp6jmyh0xc5kd123ga8yy2p4hk-glibc-2.39-52/lib/libc.so.6 8# 0x00005650D9C67395 in nix-build Aborted ``` ## Expected behavior The build continues, potentially with a warning. Maybe it should also fail the build, but cleanly? ## `nix --version` output `nix (Lix, like Nix) 2.92.0-dev-pre20241008-4ea8c9d`
lheckemann added the
bug
label 2024-10-11 14:42:50 +00:00
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/2057 ("libutil: handle json builder log messages with unexpected format")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2057", "number": 2057, "kind": "commit message"}], "cl_meta": {"2057": {"change_title": "libutil: handle json builder log messages with unexpected format"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/2057](https://gerrit.lix.systems/c/lix/+/2057) ("libutil: handle json builder log messages with unexpected format")
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#544
No description provided.