Bug 21113 – std.file.thisExePath on NetBSD depends upon the /proc filesystem

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
Other
Creation time
2020-08-04T19:41:05Z
Last change time
2020-08-05T08:20:18Z
Keywords
pull
Assigned to
No Owner
Creator
Euan Torano

Comments

Comment #0 by euan+dlang-bugzilla — 2020-08-04T19:41:05Z
The function `std.file.thisExPath` depends upon the process filesystem being mounted, which isn't the case by default. However, NetBSD provides a sysctl to get the path name similar to FreeBSD, as can be sen in this C snippet: int mib[4] = { CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME }; Documentation can be found at: https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-current It would be nice to alter the code to make use of this sysctl call instead.
Comment #1 by euan+dlang-bugzilla — 2020-08-04T20:03:57Z
I also noticed that DragonFlyBSD is using procfs too, but has the same sysctl as FreeBSD (though numbered differently of course...): https://man.dragonflybsd.org/?command=sysctl&section=3
Comment #2 by dlang-bot — 2020-08-04T20:09:12Z
@euantorano created dlang/phobos pull request #7578 "Fix issue 21113: Use sysctl for thisExePath on BSD." fixing this issue: - Fix issue 21113: Use sysctl for thisExePath on BSD. https://github.com/dlang/phobos/pull/7578
Comment #3 by dlang-bot — 2020-08-05T08:20:18Z
dlang/phobos pull request #7578 "Fix issue 21113: Use sysctl for thisExePath on BSD." was merged into master: - c51853866e38def161c34b0d88e89808d77d3551 by Euan Torano: Fix issue 21113: Use sysctl for thisExePath on BSD. https://github.com/dlang/phobos/pull/7578