From 27f57c901800c085ecc4667748b2c3a2485ee8cb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Sep 2007 14:01:14 +0000 Subject: [PATCH] * Ignore dangling symlinks in ~/.nix-defexpr. --- src/nix-env/nix-env.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index ad5a1b095..77f8a2a61 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -116,9 +116,14 @@ static void getAllExprs(EvalState & state, for (Strings::iterator i = names.begin(); i != names.end(); ++i) { Path path2 = path + "/" + *i; + + struct stat st; + if (stat(path2.c_str(), &st) == -1) + continue; // ignore dangling symlinks in ~/.nix-defexpr + if (isNixExpr(path2)) attrs.set(toATerm(*i), makeAttrRHS( - parseExprFromFile(state, absPath(path2)), makeNoPos())); + parseExprFromFile(state, absPath(path2)), makeNoPos())); else getAllExprs(state, path2, attrs); }