Skip to content

current_exe documentation incorrectly claims symlink can cause unexpected value #47264

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

Closed
alercah opened this issue Jan 8, 2018 · 3 comments
Closed

Comments

@alercah
Copy link
Contributor

alercah commented Jan 8, 2018

The documentation for std::env::current_exe claims that a symbolic link on Linux can cause an incorrect value to be returned. This isn't true, however; a hard link must be used. The ld command given in the example actually creates a hard link since -s isn't passed.

@etaoins
Copy link
Contributor

etaoins commented Jan 8, 2018

Interestingly the symbolic link does confuse Mac OS X 10.13.2:

> cat main.rs
fn main() {
    println!("{:?}", std::env::current_exe());
}
> ./main
Ok("/Users/ryan/Code/./main")
> ln -s main not-main
> ./not-main
Ok("/Users/ryan/Code/./not-main")

@etaoins
Copy link
Contributor

etaoins commented Jan 8, 2018

Looks like this was fixed in 17380f2

@pietroalbini
Copy link
Member

Yep, looks like #46987 fixed it. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants