NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.94k stars 1.53k forks source link

nix-hash process substitution example fails with `error: path '/dev/fd/63' is a symlink` on Arch Linux #11681

Open Kakadus opened 1 month ago

Kakadus commented 1 month ago

Describe the bug

I cannot run the echo example for nix-hash nix-hash --type sha256 --flat --base32 <(echo test) from https://nix.dev/manual/nix/2.24/command-ref/nix-hash#examples. Then, I only get error: path '/dev/fd/63' is a symlink.

In fact, if I run any nix-hash command that uses the <(...) syntax for input, this fails.

Steps To Reproduce

  1. run nix-hash --type sha256 --flat --base32 <(echo test)
  2. see error: path '/dev/fd/63' is a symlink

Expected behavior

I expect this to work, as it is an example command. According to the examples 1lkgqb6fclns49861dwk9rzb6xnfkxbpws74mxnx01z9qyv1pjpj should be the correct output.

nix-env --version output

nix-env (Nix) 2.24.7

Additional context

I'm on Arch Linux and used their nix package to install nix.

output of stat <(echo test):

  File: /dev/fd/63 -> pipe:[360496]
  Size: 64              Blocks: 0          IO Block: 1024   symbolic link
Device: 0,22    Inode: 349772      Links: 1
Access: (0500/lr-x------)  Uid: ( 1000/   user)   Gid: ( 1000/   user)
Access: 2024-10-11 21:28:46.230728151 +0200
Modify: 2024-10-11 21:28:46.230728151 +0200
Change: 2024-10-11 21:28:46.230728151 +0200
 Birth: -

Priorities

Add :+1: to issues you find important.

jwiegley commented 1 week ago

I'm also experiencing this error now on macOS, except that the error reports that /var is a symlink.

ofalvai commented 1 week ago

I think it's also what broke swiftpm2nix recently. That error surfaces as:

-- Fetching Commander
Initialized empty Git repository in /private/tmp/git-checkout-tmp-G27B0tSB/Commander-4b6133c/.git/
remote: Enumerating objects: 41, done.
remote: Counting objects: 100% (41/41), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 41 (delta 1), reused 16 (delta 1), pack-reused 0 (from 0)
Unpacking objects: 100% (41/41), 31.18 KiB | 1.04 MiB/s, done.
From https://github.com/kylef/Commander
 * tag               0.9.1      -> FETCH_HEAD
Switched to a new branch 'fetchgit'
removing `.git'...
error: path '/tmp' is a symlink