diff options
author | Håkan Mattsson <[email protected]> | 2016-12-22 09:57:21 +0100 |
---|---|---|
committer | Håkan Mattsson <[email protected]> | 2016-12-22 14:43:15 +0100 |
commit | 1d8dbc7123245a536df6bb09e891d3a075fb70ed (patch) | |
tree | b867ffae19324c06c0578b6c5bfef05158074198 /erts/emulator/test/dirty_nif_SUITE_data/dirty_nif_SUITE.c | |
parent | 691a6d0f68c5a2ef64315dd4d7759aa7aa8e2e99 (diff) | |
download | otp-1d8dbc7123245a536df6bb09e891d3a075fb70ed.tar.gz otp-1d8dbc7123245a536df6bb09e891d3a075fb70ed.tar.bz2 otp-1d8dbc7123245a536df6bb09e891d3a075fb70ed.zip |
escript: Handle symbolic link to a standalone escript
The code has been rearranged to make use of the actual path
"get_default_emulator(scriptname)" to the escript instead of
the given one "get_default_emulator(argv[0])".
TL;DR
Assume a source system with some Erlang applications (app1, app2 etc.)
and an escript called "mytool". When generating a standalone target
system (with reltool for example), the escript(s) are located in the
same top bin directory as "erl". See mytool* below.
In such a system the original "mytool" escript is given the extension
".escript" and the file with the same name as the original escript is
a copy of the "escript" executable. One purpose of the escript
executable is to determine which "erl" to use to start the system.
In a standalone system we want it to find the runtime system bundled
with the escript(s). This is done by analyzing the path in order to
find the "erl" located in the same directory as the escript.
A dilemma here is that we do not want to put the top bin directory
in the execution path (PATH env var) as we then would cause other
Erlang applications to make use of our bundled run-time system.
One way of solving this is to choose some suitable bin directory in
the execution path (such as /user/local/bin) and put a symbolic link
there to our mytool executable.
Unfortunately this did not work as the escript executable (in this
case called mytool) would try to find "erl" in /usr/local/bin and when
it did not find such a file it resorted to use the command "erl" which
would find some (unwanted) "erl" in the execution path.
My fix solves that problem.
├── bin/
│ ├── erl* (dyn_erl.c)
│ ├── mytool* (escript.c)
│ ├── mytool.escript* (original mytool escript)
│ └── start_clean.boot
├── erts-vsn/
│ └── bin/
│ ├── beam*
│ ├── beam.smp*
│ ├── erl*
│ ├── erl_child_setup*
│ ├── erlexec*
│ └── inet_gethost*
└── lib/
├── app1-vsn
├── app2-vsn
└── ...
Diffstat (limited to 'erts/emulator/test/dirty_nif_SUITE_data/dirty_nif_SUITE.c')
0 files changed, 0 insertions, 0 deletions