You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Overlay PATH lookup picks a file the current user can't execute (e.g. root-owned 0700), so the start fails with "Permission denied" where the shell runs the next match (net7+) #143
Since #137, when EnvironmentVariables overrides PATH, RunCommand resolves a bare executable name itself (ResolveOnSearchPath) and pins startInfo.FileName to the result (RunCommand/RunCommand.cs:413-417).
The per-candidate check in TryExecutable (RunCommand/RunCommand.cs:528-533, net7+) accepts a file if any of the user, group or other execute bits is set:
It never checks whether the current user can execute the file. A file with mode 0700 owned by another user passes the check and ends the search, though execve will refuse it.
execvp, the shell, and .NET's own PATH search all skip such a file and keep looking. .NET's own search is the one used when there is no overlay, and it checks the bit that applies to the effective uid and gid.
Add a test, Unix-only and skipped when running as root, that fails today:
An earlier PATH entry holds a file the test user can't execute: owned by another user with mode 0700, or owned by the test user with mode 0070 or 0007.
A later entry holds an executable copy.
The test asserts that the later one runs.
It's probably simplest to fix this together with #139, so all target frameworks share one executability check.
Priority: Medium. With a PATH overlay, a command fails to start where the shell would run it. It needs a specific setup: an earlier PATH match owned by another user, with permissions that don't let the caller execute it.
Area / suggested assignment:RunCommand.TryExecutable / ResolveOnSearchPath (overlay PATH resolution).
Activity
matt-edmondson commentedon Nov 4, 2026
Triage
RunCommand.TryExecutable/ResolveOnSearchPath(overlay PATH resolution).access(path, X_OK)on every non-Windows target. That is the alternative this issue suggests, and it should cover this case too. Before working on this separately, check whether Ask access(X_OK) whether an overlay PATH match may run, on every target [patch] #141 already has a test for a candidate that has an execute bit the caller doesn't hold, and if it does, link this issue from it. Note thataccesschecks the real uid/gid, not the effective one;faccessat(..., AT_EACCESS)is the exact match if setuid callers matter.Generated by Claude Code