In the issues in #11535 I made reference to applying the Windows behavior of the app domain is the location of the symbolic link to Linux #121070
Unanswered
jhudsoncedaron
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I wrote: We had actually discovered the behavior was different on Linux and used a LD_PRELOAD to prevent the loader from noticing it was a symbolic link.
So the way this is fixed id clearly an LD_PRELOAD that intercepts realpath. When launching a binary via bash, _ is set to the path to the binary, which unlike
/proc/self/exeis the symbolic link path. Other launchers don't do this and appear to expect you to look at argv[0] and the PATH environment variable. I found it most expedient to manually set _ in systemd unit files to get the bash behavior anyway.Here are the comments from the implementation:
This results in realpath("/proc/self/exe") => getenv("_") but only where _ refers to a symbolic link to of the actual binary.
In addition, any attempt to resolve any path starting with /path/to/exename simply returns the path again. Thus the loader is completely fooled into thinking the symbolic link tree directory is the actual application domain directory.
For reasons that should be obvious; I would advise not trying to change the behavior so that _ is trusted as the correct value for everybody. (Likely to cause the opposite problem as #11535 for somebody else.) But I do wonder if the call that is
realpath("/path/to/entryassembly.dll")is excessive.Beta Was this translation helpful? Give feedback.
All reactions