-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stack overflow (possible infinite recursion) depending on type of git checkout #42379
Comments
Hmm, I also occasionally encountered this but did not connect it with git. Maybe it has something to do with how nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh Lines 314 to 323 in 5ac6ab0
|
Thanks for the hint. After rebasing my |
I've run into this on occasion as well. Today I figured out that |
using This leads me to believe that the problem occurs when
... which is running This would also explain why the build works fine in a git worktree, since there |
Yeah, that looks like NixOS/nix#2147 |
Yes, thank you! The |
wow I just hit this after adding a bunch of remotes and typing |
here is my packed-refs file if anyone wants to reproduce: https://jb55.com/s/7669361c5a10dc31.txt |
@jb55 We are pretty certain this is a duplicate of NixOS/nix#2147, see Matt’s analysis above. |
correct, just wanted to clarify for sure where it was happening for other people googling the problem. Setting ulimit didn't seem to work. Moving |
Maybe you just need a larger limit? If you can't find a larger |
larger ulimits don't seem to work... and I tried some pretty large numbers. perhaps I've reached a max value or something. |
One and a half years ago I decided to stop messing with this issue and rebased this commit ontop of diff --git a/lib/sources.nix b/lib/sources.nix
index 51bcf5559e3..9fd09f33139 100644
--- a/lib/sources.nix
+++ b/lib/sources.nix
@@ -105,31 +105,31 @@ rec {
# Get the commit id of a git repo
# Example: commitIdFromGitRepo <nixpkgs/.git>
- commitIdFromGitRepo =
- let readCommitFromFile = file: path:
- with builtins;
- let fileName = toString path + "/" + file;
- packedRefsName = toString path + "/packed-refs";
- in if lib.pathExists fileName
- then
- let fileContent = lib.fileContents fileName;
- # Sometimes git stores the commitId directly in the file but
- # sometimes it stores something like: «ref: refs/heads/branch-name»
- matchRef = match "^ref: (.*)$" fileContent;
- in if matchRef == null
- then fileContent
- else readCommitFromFile (lib.head matchRef) path
- # Sometimes, the file isn't there at all and has been packed away in the
- # packed-refs file, so we have to grep through it:
- else if lib.pathExists packedRefsName
- then
- let fileContent = readFile packedRefsName;
- matchRef = match (".*\n([^\n ]*) " + file + "\n.*") fileContent;
- in if matchRef == null
- then throw ("Could not find " + file + " in " + packedRefsName)
- else lib.head matchRef
- else throw ("Not a .git directory: " + path);
- in readCommitFromFile "HEAD";
+ commitIdFromGitRepo = x: "notarealversion";
+ # let readCommitFromFile = path: file:
+ # with builtins;
+ # let fileName = toString path + "/" + file;
+ # packedRefsName = toString path + "/packed-refs";
+ # in if lib.pathExists fileName
+ # then
+ # let fileContent = lib.fileContents fileName;
+ # # Sometimes git stores the commitId directly in the file but
+ # # sometimes it stores something like: «ref: refs/heads/branch-name»
+ # matchRef = match "^ref: (.*)$" fileContent;
+ # in if isNull matchRef
+ # then fileContent
+ # else readCommitFromFile path (lib.head matchRef)
+ # # Sometimes, the file isn't there at all and has been packed away in the
+ # # packed-refs file, so we have to grep through it:
+ # else if lib.pathExists packedRefsName
+ # then
+ # let fileContent = readFile packedRefsName;
+ # matchRef = match (".*\n([^\n ]*) " + file + "\n.*") fileContent;
+ # in if isNull matchRef
+ # then throw ("Could not find " + file + " in " + packedRefsName)
+ # else lib.head matchRef
+ # else throw ("Not a .git directory: " + path);
+ # in lib.flip readCommitFromFile "HEAD";
pathHasContext = builtins.hasContext or (lib.hasPrefix builtins.storeDir); As I recently started building my systems using the experimental flakes feature, I don't see this error anymore. So maybe we can have peace from this pesky failure mode someday? Edit: Rereading this I'd like to clarify, that I don't want to sound demanding here. Just wanted to note that with dropping impure evaluation in flakes, we won't have this instance of NixOS/nix#2147 anymore. |
I'll reopen this, even though it's technically an issue in nix, since it's still a problem and the closed status suggests (e.g. in issue searches) that it's not, i.e. for discoverability. If anyone disagrees, do say so :) |
Current workarounds:
|
Worked around in #93337. |
Issue description
I'm able to provoke an
based on wether I checked out my branch or checked out the current commit of that branch in my Nixpkgs fork. The Nix expressions do not change, but the error is magically very stable.
Steps to reproduce
My setup is, that I manage my patches ontop of
nixos-18.03
in a branch calledcustom-18.03
. Git staging area is empty. As this is my working system, it is sort of complex, but not fancy enough to explain any behaviour like this one. The patches I maintain are basically version bumps and some backports of packages only available onnixos-unstable
.I can reliably cycle (like 10 times in a row) between failure and success with this sequence:
As you can see, my system evaluates without error, as long I don't checkout my branch, but its commit.
I understand that this is not a good starting point for debugging and I would be glad to provide an instruction being better reproducible. But as this error appears to be absolutely magically to me, I have no idea where to start symplifying the error. I do not even know, wether this is Nix or Nixpkgs related.
Would be glad if anyone could provide me with a hint where to start.
Technical details
"x86_64-linux"
Linux 4.14.51, NixOS, 18.03 (Impala)
yes
yes
nix-env (Nix) 2.0.4
/home/justin/nixpkgs
The text was updated successfully, but these errors were encountered: