-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
Describe the bug
I was writing a program today that calls into nix as external tool. I forgot to strip the newline in computed attribute and crashed the nix binary. I think it's unexpected. It should be an attribute error (or syntax error):
$ nix eval --impure --raw "$(printf "/tmp/anything#\n.config")"
terminating due to unexpected unrecoverable internal error: Assertion 'succeeds' failed in std::pair<nix::FlakeRef, std::__cxx11::basic_string<char> > nix::parsePathFlakeRefWithFragment(const fetchers::Settings&, const std::string&, const std::optional<std::__cxx11::basic_string<char> >&, bool, bool, bool) at ../flakeref.cc:83
Nix crashed. This is a bug. Please report this at https://github.com/NixOS/nix/issues with the following information included:
std::terminate() called without exception
Stack trace:
0# 0x000055B45E7E4341 in nix
1# 0x00007FD6A06BF1AA in /nix/store/xp989kyfg52803fmkzbz5py35jphcpgd-gcc-14.3.0-lib/lib/libstdc++.so.6
2# std::unexpected() in /nix/store/xp989kyfg52803fmkzbz5py35jphcpgd-gcc-14.3.0-lib/lib/libstdc++.so.6
3# 0x00007FD6A159D2AF in /nix/store/dps6frxkcp0khxvzzlk2zjxvby6283nf-nix-util-2.32.1+2/lib/libnixutil.so.2.32.1+2
4# __wrap___assert_fail in /nix/store/596pgi6afwjhc35x822fn28v644zlv60-nix-flake-2.32.1+2/lib/libnixflake.so.2.32.1+2
5# nix::parsePathFlakeRefWithFragment(nix::fetchers::Settings const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, bool, bool, bool) in /nix/store/596pgi6afwjhc35x822fn28v644zlv60-nix-flake-2.32.1+2/lib/libnixflake.so.2.32.1+2
6# nix::parseFlakeRefWithFragment(nix::fetchers::Settings const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, bool, bool, bool) in /nix/store/596pgi6afwjhc35x822fn28v644zlv60-nix-flake-2.32.1+2/lib/libnixflake.so.2.32.1+2
7# nix::SourceExprCommand::parseInstallables(nix::ref<nix::Store>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) in /nix/store/18hymlqpx51hcn7byp3a8iipm5gxckz8-nix-cmd-2.32.1+2/lib/libnixcmd.so.2.32.1+2
8# nix::SourceExprCommand::parseInstallable(nix::ref<nix::Store>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in /nix/store/18hymlqpx51hcn7byp3a8iipm5gxckz8-nix-cmd-2.32.1+2/lib/libnixcmd.so.2.32.1+2
9# nix::InstallableCommand::run(nix::ref<nix::Store>) in /nix/store/18hymlqpx51hcn7byp3a8iipm5gxckz8-nix-cmd-2.32.1+2/lib/libnixcmd.so.2.32.1+2
10# nix::StoreCommand::run() in /nix/store/18hymlqpx51hcn7byp3a8iipm5gxckz8-nix-cmd-2.32.1+2/lib/libnixcmd.so.2.32.1+2
11# 0x000055B45E85444A in nix
12# nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) in /nix/store/g87hzp2rzrz64xwwbc64fkcx0d5xk9gb-nix-main-2.32.1+2/lib/libnixmain.so.2.32.1+2
13# 0x000055B45E7BCC9B in nix
14# 0x00007FD6A022A4D8 in /nix/store/qhw0sp183mqd04x5jp75981kwya64npv-glibc-2.40-66/lib/libc.so.6
15# __libc_start_main in /nix/store/qhw0sp183mqd04x5jp75981kwya64npv-glibc-2.40-66/lib/libc.so.6
16# 0x000055B45E7C1145 in nix
Aborted (core dumped) nix eval --impure --raw "$(printf "/tmp/anything#\n.config")"
Metadata
$ nix-env --version
nix-env (Nix) 2.32.1+2
Checklist
- checked latest Nix manual (source)
- checked open bug issues and pull requests for possible duplicates
Add 👍 to issues you find important.
roberth