-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Fix current_exe() on DragonFly #35494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The method using procfs did only work in case procfs is mounted, which we cannot expect, especially as procfs is deprecated on DragonFly. Starting with DragonFly 4.6.1 the sysctl method works correctly, so try sysctl first, and if it returns a path including a ":" (which is an invalid path), try to read from procfs before giving up.
(rust_highfive has picked a reviewer for you, use r? to override) |
I’m not sure detection by checking |
@nagisa: yes, you are right. but Rust uses |
// the procfs method. We determine an older version by inspecting the returned path. If it contains | ||
// an ":", we try the procfs method. | ||
// | ||
// [1]: https://gitweb.dragonflybsd.org/dragonfly.git/commit/726f7ca07e193db73635e9c4e24e40c96087d6d9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is wider than 100 columns, fails make tidy
.
@bors r- pending tidy fix |
Closing due to inactivity, but feel free to resubmit with tidy fixed! |
…chton Fix current_exe() on DragonFly (again) This is a follow up on [this pull request][1]. Since DragonFly 4.6.1 ([this commit][2]), the ```kern.proc.pathname``` sysctl works correctly, i.e. it does not return paths including a ```:``` (see [here][3]). Use it and don't try to fix old versions of DragonFly! There are not many DragonFly installations out there that we can't control and no one is compiling Rust from source. If someone wants to run Rust on a pre-4.6.1 DragonFly system, the ports system should provide a patch. [1]: #35494 [2]: https://gitweb.dragonflybsd.org/dragonfly.git/commit/726f7ca07e193db73635e9c4e24e40c96087d6d9 [3]: https://gist.github.com/mneumann/a2f6b6a0a03935b561d6185872a4b222
The method using procfs did only work in case procfs is mounted,
which we cannot expect, especially as procfs is deprecated on
DragonFly. Starting with DragonFly 4.6.1 the sysctl method works
correctly, so try sysctl first, and if it returns a path including
a ":" (which is an invalid path), try to read from procfs before
giving up.