Description
Passing an empty string to nix path-info causes a crash with Abort trap: 6 instead of a clean error message. The crash report incorrectly attributes this to nix::Interrupted ("interrupted by the user"), even though no interrupt was sent.
Steps to Reproduce
Expected Behavior
A clean validation error such as error: invalid store path '' or similar.
Actual Behavior
Nix crashes with Abort trap: 6 and the following output:
error: interrupted by the user
Determinate Nix crashed. This is a bug. Please report this at https://github.com/DeterminateSystems/nix-src/issues with the following information included:
Exception: nix::Interrupted: error: interrupted by the user
Stack trace:
0# nix::(anonymous namespace)::onTerminate() in /nix/store/w75hyfqa1p3vy04x8zn4237pqgqfwicp-determinate-nix-3.17.0/bin/nix
1# std::__terminate(void (*)()) in /nix/store/sg5gfy9cj0991jbd4xfyrl21rmqib9r2-libcxx-19.1.7/lib/libc++abi.1.0.dylib
2# __cxa_rethrow in /nix/store/sg5gfy9cj0991jbd4xfyrl21rmqib9r2-libcxx-19.1.7/lib/libc++abi.1.0.dylib
3# nix::ignoreExceptionExceptInterrupt(nix::Verbosity) in /nix/store/lg8s87vqpmigbgpkm7f7g549k946lqfa-determinate-nix-util-3.17.0/lib/libnixutil.2.33.3.dylib
4# nix::JSONLogger::write(...) in /nix/store/lg8s87vqpmigbgpkm7f7g549k946lqfa-determinate-nix-util-3.17.0/lib/libnixutil.2.33.3.dylib
5# nix::JSONLogger::logEI(nix::ErrorInfo const&) in /nix/store/lg8s87vqpmigbgpkm7f7g549k946lqfa-determinate-nix-util-3.17.0/lib/libnixutil.2.33.3.dylib
6# nix::TeeLogger::logEI(nix::ErrorInfo const&) in /nix/store/lg8s87vqpmigbgpkm7f7g549k946lqfa-determinate-nix-util-3.17.0/lib/libnixutil.2.33.3.dylib
7# nix::handleExceptions(...) in /nix/store/yijfh1mylylgbs1j7sp35n517wf7ccfc-determinate-nix-main-3.17.0/lib/libnixmain.2.33.3.dylib
8# main in /nix/store/w75hyfqa1p3vy04x8zn4237pqgqfwicp-determinate-nix-3.17.0/bin/nix
Abort trap: 6
Environment
- Nix version: determinate-nix-3.17.0
- OS: macOS (Darwin 25.2.0, arm64)
- Shell: bash 5.3
Notes
The root cause appears to be in ignoreExceptionExceptInterrupt: when processing an empty-string path, some internal operation raises a nix::Interrupted exception (likely triggered by invalid input triggering a signal), which is then re-thrown by ignoreExceptionExceptInterrupt and left unhandled, causing std::terminate to be called via __cxa_rethrow.
The same crash occurs when the empty string originates from an unset shell variable (nix path-info -Sh "$out" where out is empty).
Reported on behalf of user by Claude
Description
Passing an empty string to
nix path-infocauses a crash withAbort trap: 6instead of a clean error message. The crash report incorrectly attributes this tonix::Interrupted("interrupted by the user"), even though no interrupt was sent.Steps to Reproduce
nix path-info -Sh ""Expected Behavior
A clean validation error such as
error: invalid store path ''or similar.Actual Behavior
Nix crashes with
Abort trap: 6and the following output:Environment
Notes
The root cause appears to be in
ignoreExceptionExceptInterrupt: when processing an empty-string path, some internal operation raises anix::Interruptedexception (likely triggered by invalid input triggering a signal), which is then re-thrown byignoreExceptionExceptInterruptand left unhandled, causingstd::terminateto be called via__cxa_rethrow.The same crash occurs when the empty string originates from an unset shell variable (
nix path-info -Sh "$out"whereoutis empty).Reported on behalf of user by Claude