Not sure this is a nix issue it could be the git repo or something but here is the exact error message I am getting:
Note: Could this be related to this issue? "Bad file descriptor" and "Too many open files" · Issue #101459 · NixOS/nixpkgs · GitHub
In my case I don’t see any errors about too many files open but I do see bad file descriptors in two different repos.
I am on MacOS Monterey M1 processor and my nix.conf is:
build-users-group = nixbld
sandbox = false
system = x86_64-darwin
extra-platforms = x86_64-darwin aarch64-darwin
experimental-features = nix-command
extra-experimental-features = flakes
extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env
substituters = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
Here is output
sudo nix-shell --show-trace
building '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv'...
ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor
error: builder for '/nix/store/zcv0q6cmd39zr580w9sq0z1wbkak0mqk-git-ls-files.drv' failed with exit code 1
… while realising the context of path '/nix/store/g0769lx8bm7lna4gsdchiayk6n7gdcx5-git-ls-files/files'
at /nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source/lib/clean-git.nix:146:26:
145| submoduleDirs = lines (readFile (files + "/submoduleDirs"));
146| files = lines (readFile (files + "/files"));
| ^
147| };
… while evaluating 'lines'
at /nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source/lib/clean-git.nix:33:11:
32|
33| lines = s: filter (x : x != [] && x != "") (split "\n" s);
| ^
34|
I had another error on a different location and got details here:
Error^@^@^@^@^@^@^@^@^@^@^@^E^@^@^@^@^@^@^@Error
^@^@^@x^@^@^@^@^@^@^@executing
' **/nix/store/067f780bk90ghn7yhz914d5fykmll7a4-bash-5.1-p16/bin/bas** >
Here is another example on different git repo:
nix-build
building '/nix/store/9z2bhjz6slfphlm4xbpkh9c0hzll46kh-source.drv'...
ErrorErrorxexecuting ' **/nix/store/067f780bk90ghn7yhz914d5fykmll7a4-bash-5.1-p16/bin/bash** ': **Bad file descriptor**
**error:** builder for ' **/nix/store/9z2bhjz6slfphlm4xbpkh9c0hzll46kh-source.drv** ' failed with exit code 1;
last 2 log lines:
>
> ErrorErrorxexecuting ' **/nix/store/067f780bk90ghn7yhz914d5fykmll7a4-bash-5.1- p16/bin/bash** ': **Bad file descriptor**
For full logs, run ' **nix log /nix/store/9z2bhjz6slfphlm4xbpkh9c0hzll46kh-source.drv** '.
(use '--show-trace' to show detailed location information)
% nix log /nix/store/9z2bhjz6slfphlm4xbpkh9c0hzll46kh-source.drv
^A
^E^@^@^@^@^@^@^@Error^@^@^@^@^@^@^@^@^@^@^@^E^@^@^@^@^@^@^@Error^@^@^@x^@^@^@^@>
lines 1-2/2 (END)
PS: I did try temporarily increasing the file descriptor limits from 256 to higher value but same issue continues. However, I did not update the file in nix/store yet. Can someone please explain how I can get nix to redownload this file again? I have another open question about if there is some command like nix-clean to clean cache or store? How is this done?