Skip to content
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

Sys.executable_name on Linux does not use /proc/self/exe if full path exceeds 256 characters #7626

Closed
vicuna opened this Issue Sep 13, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Sep 13, 2017

Original bug ID: 7626
Reporter: ceastlund
Assigned to: @gasche
Status: resolved (set by @xavierleroy on 2017-09-24T15:17:04Z)
Resolution: fixed
Priority: normal
Severity: minor
OS: Linux
Version: 4.04.2
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: runtime system and C interface
Monitored by: @gasche

Bug description

On Linux, Sys.executable_name depends on /proc/self/exe if the symlink can be read, and otherwise falls back on argv[0]. The buffer used to read /proc/self/exe is 256 characters, so for long paths this always fails.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Sep 14, 2017

Comment author: @gasche

I believe that this was already fixed by Xavier Leroy in the commit

a91d6a5

which was included in 4.05.

Could you try to reproduce the issue using 4.05.0?

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Sep 14, 2017

Comment author: ceastlund

I tried this with 4.05.0 and while that patch is included, Sys.executable_name still does not match /proc/self/exe for long paths. I still get the argv[0] form of the path.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Sep 14, 2017

Comment author: @xclerc

There has been recent activity on the PR that led to the commit
pointed by gasche:

https://github.com/ocaml/ocaml/pull/795

It might be worthwhile to test with trunk.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Sep 24, 2017

Comment author: @xavierleroy

Tested on 4.06 with an executable file name of 349 characters, correctly read from /proc/self/exe. If you're still observing failures, please reopen this report.

@vicuna vicuna closed this Sep 24, 2017

@vicuna vicuna added the stdlib label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.