nix shell does not restore default SIGPIPE handler #912

Open
opened 2025-07-11 20:01:21 +00:00 by cobaltcause · 5 comments
Member

Describe the bug

Title authored by @dramforever:matrix.org.

Steps To Reproduce

  1. Run e.g. tr -dc '[:alnum:]' < /dev/urandom | head -c 64 > /dev/null
  2. Observe that it works with no error
  3. Run e.g. nix shell nixpkgs#hello
  4. Run the first command again in the shell from the previous step
  5. See error

Expected behavior

The behavior should be the same both inside and outside of a shell, so probably something about nix shell needs to be changed.

nix --version output

nix (Lix, like Nix) 2.94.0-dev
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /root/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/root/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/root/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/root/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/ip9h0a9v65z3z8k7b777v038s7ph2fxg-lix-2.94.0-dev/share

(487b37291f)

## Describe the bug Title authored by @dramforever:matrix.org. ## Steps To Reproduce 1. Run e.g. `tr -dc '[:alnum:]' < /dev/urandom | head -c 64 > /dev/null` 2. Observe that it works with no error 3. Run e.g. `nix shell nixpkgs#hello` 4. Run the first command again in the shell from the previous step 5. See error ## Expected behavior The behavior should be the same both inside and outside of a shell, so probably something about `nix shell` needs to be changed. ## `nix --version` output ``` nix (Lix, like Nix) 2.94.0-dev System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /root/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/root/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/root/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/root/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/ip9h0a9v65z3z8k7b777v038s7ph2fxg-lix-2.94.0-dev/share ``` (487b37291f9344b1c99802fd202667ef73f4b8e8)
Owner

Tested on macOS on 378b360, does not repro. Unsure if yours is newer, seems that we have had a Situation with the versions getting into the derivation meaningfully.

Tested on macOS on 378b360, does not repro. Unsure if yours is newer, seems that we have had a Situation with the versions getting into the derivation meaningfully.
Owner

doesn't repro under linux either. lix never installs a non-default sigpipe handler, it only masks sigpipe—and nix shell definitely restores the signal mask it was started with before it exec's the inner shell.

doesn't repro under linux either. lix never installs a non-default sigpipe handler, it only masks sigpipe—and `nix shell` definitely restores the signal mask it was started with before it exec's the inner shell.
Member

I'm able to reproduce this on a couple linux systems with ae00b12983.

I'm able to reproduce this on a couple linux systems with ae00b1298353a43a10bbecea8220471731db10ec.
Owner

Would you be able to bisect this? It's really weird this is happening at all and I feel like that might be the strategy.

Would you be able to bisect this? It's really weird this is happening at all and I feel like that might be the strategy.
Member

Yeah, I should be able to try bisecting it at some point in the next few days.

Yeah, I should be able to try bisecting it at some point in the next few days.
Sign in to join this conversation.
No milestone
No project
No assignees
4 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#912
No description provided.