nix/doctor: skip inaccessible PATH elems for duplicate nix

Inaccessible-but-extant PATH elements can't be executed anyway, so we
can skip them as if they didn't exist, instead of erroring like before.

Change-Id: I9288c3ecb6768171e62a3088122d98421558eb03
This commit is contained in:
Qyriad
2025-11-03 14:41:47 +00:00
parent d15b99f489
commit a30d87eadc
+2 -1
View File
@@ -79,7 +79,8 @@ struct CmdDoctor : StoreCommand
PathSet dirs;
for (auto & dir : tokenizeString<Strings>(getEnv("PATH").value_or(""), ":"))
if (pathExists(dir + "/nix-env"))
// Inaccessible-but-extant PATH elements can't be executed anyway.
if (pathAccessible(dir + "/nix-env"))
dirs.insert(dirOf(canonPath(dir + "/nix-env", true)));
if (dirs.size() != 1) {