Skip to content

Implement getexepath for OpenBSD#129103

Merged
janvorli merged 1 commit into
dotnet:mainfrom
am11:patch-46
Jun 8, 2026
Merged

Implement getexepath for OpenBSD#129103
janvorli merged 1 commit into
dotnet:mainfrom
am11:patch-46

Conversation

@am11

@am11 am11 commented Jun 7, 2026

Copy link
Copy Markdown
Member

Contributes to #124911.

@github-actions github-actions Bot added the area-PAL-coreclr only for closed issues label Jun 7, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 7, 2026
@am11 am11 added the os-openbsd OpenBSD OS, currently not officially supported label Jun 7, 2026
@am11

am11 commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

cc @janvorli, @sethjackson, minipal_getexepath is a best effort API on OpenBSD, as the platform intentionally lacks a direct kernel interface (like FreeBSD's KERN_PROC_PATHNAME) for the absolute executable path.

argv is normally fine to get the executable path (https://stackoverflow.com/q/31494901). I have tested it on the VM with scenarios like 'running from same dir' and 'running from different dir' and realpath does the job well in the end.

The only downside of relying on argv is that if someone spawns this process and manually rewrites argv to a different/dummy value, then it will get that val (but it's not a sane thing to do so we shouldn't worry 😅).

@am11 am11 requested review from janvorli and jkotas June 8, 2026 20:56

@janvorli janvorli 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, thank you!

@janvorli janvorli merged commit e3d5aac into dotnet:main Jun 8, 2026
196 of 200 checks passed
@am11 am11 deleted the patch-46 branch June 8, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-PAL-coreclr only for closed issues community-contribution Indicates that the PR has been added by a community member os-openbsd OpenBSD OS, currently not officially supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants