You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 825 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
The fix for bug 557 means that another program cannot communicate information to
an ocaml program via argv[0] during an execv(), (even if the ocaml program is
built optimized).
My situation is that I have written a trampoline program to use for Ocaml
scripting instead of a custom toplevel (because custom toplevel can print
diagnostics to stdout, which is not good for scripts that act like filters).
My program is invoked via the interpreter line, does its magic to build the
script, if necessary, then invokes the built executable via execv(). Naturally
I want argv[0] to be the original script, but what I get, due to the fact that
Ocaml grabs that value from /proc, is the path to the cached executable, not the
script. I should be able to override argv[0] by passing the value I want in the
arg array to execv(), but the fix for 557 prevents this.
I would like to propose an alternate fix for 557: If bytecode programs need to
find themselves, then I believe that they can take argv[0], if it is absolute,
or prepend getcwd(), if it is relative. Alternatively, maybe the fix for 557
could only apply to bytecode programs, not programs built by ocamlopt.
Thanks,
Doug
The text was updated successfully, but these errors were encountered:
Original bug ID: 825
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Doug Bagley
Version: 3.04
OS: Linux
Submission from: kof.bagley.org (216.30.46.7)
The fix for bug 557 means that another program cannot communicate information to
an ocaml program via argv[0] during an execv(), (even if the ocaml program is
built optimized).
My situation is that I have written a trampoline program to use for Ocaml
scripting instead of a custom toplevel (because custom toplevel can print
diagnostics to stdout, which is not good for scripts that act like filters).
My program is invoked via the interpreter line, does its magic to build the
script, if necessary, then invokes the built executable via execv(). Naturally
I want argv[0] to be the original script, but what I get, due to the fact that
Ocaml grabs that value from /proc, is the path to the cached executable, not the
script. I should be able to override argv[0] by passing the value I want in the
arg array to execv(), but the fix for 557 prevents this.
I would like to propose an alternate fix for 557: If bytecode programs need to
find themselves, then I believe that they can take argv[0], if it is absolute,
or prepend getcwd(), if it is relative. Alternatively, maybe the fix for 557
could only apply to bytecode programs, not programs built by ocamlopt.
Thanks,
Doug
The text was updated successfully, but these errors were encountered: