Skip to content

Process.Unix: skip non-executable files during process filename resolution. - #130281

Merged
adamsitnik merged 2 commits into
dotnet:mainfrom
tmds:fix-non-executable-resolve
Jul 7, 2026
Merged

adamsitnik merged 2 commits into
dotnet:mainfrom
tmds:fix-non-executable-resolve

Conversation

@tmds

@tmds tmds commented Jul 7, 2026

Copy link
Copy Markdown
Member

Use access(X_OK) in IsExecutable instead of manually checking mode bits and user/group membership. This is simpler and handles edge cases like ACLs and capabilities correctly.

Change filename resolution to use IsExecutable instead of File.Exists so non-executable files in the working directory or relative paths don't shadow executable files on PATH.

Remove the redundant access(X_OK) check from native ForkAndExecProcessInternal since the managed side now checks executability before calling it.

Fixes #129736.

@adamsitnik ptal.

…ution.

Use access(X_OK) in IsExecutable instead of manually checking mode
bits and user/group membership. This is simpler and handles edge
cases like ACLs and capabilities correctly.

Change filename resolution to use IsExecutable instead of File.Exists
so non-executable files in the working directory or relative paths
don't shadow executable files on PATH.

Remove the redundant access(X_OK) check from native
ForkAndExecProcessInternal since the managed side now checks
executability before calling it.
@tmds
tmds force-pushed the fix-non-executable-resolve branch from 5dacbb5 to 3fb2487 Compare July 7, 2026 03:35
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 7, 2026
@tmds tmds changed the title Skip non-executable files during process filename resolution. Process.Unix: skip non-executable files during process filename resolution. Jul 7, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

@adamsitnik adamsitnik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it's great to see such nice simplification! Thank you for your contribution @tmds !

@adamsitnik
adamsitnik enabled auto-merge (squash) July 7, 2026 07:53
@adamsitnik adamsitnik added this to the 11.0.0 milestone Jul 7, 2026
@adamsitnik
adamsitnik merged commit 726c2e8 into dotnet:main Jul 7, 2026
119 of 121 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot modified the milestones: 11.0.0, 11.0-preview7 Jul 8, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
…ution. (#130281)

Use access(X_OK) in IsExecutable instead of manually checking mode bits
and user/group membership. This is simpler and handles edge cases like
ACLs and capabilities correctly.

Change filename resolution to use IsExecutable instead of File.Exists so
non-executable files in the working directory or relative paths don't
shadow executable files on PATH.

Remove the redundant access(X_OK) check from native
ForkAndExecProcessInternal since the managed side now checks
executability before calling it.

Fixes #129736
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Diagnostics.Process community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Process.Start resolves non-executable paths on Unix

2 participants