From: Stephane Glondu Date: Tue, 24 May 2011 10:27:34 +0000 (+0200) Subject: Properly initialize executable name in caml_startup_code (Closes: #627756) X-Git-Tag: archive/raspbian/4.08.1-4+rpi1~3^2~302 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a6112e9953f49452dfc9e9ebd2fd972e8435b2d2;p=ocaml.git Properly initialize executable name in caml_startup_code (Closes: #627756) --- diff --git a/debian/patches/0012-Properly-initialize-executable-name-in-caml_startup_.patch b/debian/patches/0012-Properly-initialize-executable-name-in-caml_startup_.patch new file mode 100644 index 00000000..21067547 --- /dev/null +++ b/debian/patches/0012-Properly-initialize-executable-name-in-caml_startup_.patch @@ -0,0 +1,47 @@ +From: Stephane Glondu +Date: Tue, 24 May 2011 12:16:20 +0200 +Subject: Properly initialize executable name in caml_startup_code + +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627756 +Signed-off-by: Stephane Glondu +--- + byterun/startup.c | 11 ++++++++++- + 1 files changed, 10 insertions(+), 1 deletions(-) + +diff --git a/byterun/startup.c b/byterun/startup.c +index 57cbb73..9fe288c 100644 +--- a/byterun/startup.c ++++ b/byterun/startup.c +@@ -443,6 +443,10 @@ CAMLexport void caml_startup_code( + { + value res; + char* cds_file; ++ char * exe_name; ++#ifdef __linux__ ++ static char proc_self_exe[256]; ++#endif + + caml_init_ieee_floats(); + caml_init_custom_operations(); +@@ -455,6 +459,11 @@ CAMLexport void caml_startup_code( + strcpy(caml_cds_file, cds_file); + } + parse_camlrunparam(); ++ exe_name = argv[0]; ++#ifdef __linux__ ++ if (caml_executable_name(proc_self_exe, sizeof(proc_self_exe)) == 0) ++ exe_name = proc_self_exe; ++#endif + caml_external_raise = NULL; + /* Initialize the abstract machine */ + caml_init_gc (minor_heap_init, heap_size_init, heap_chunk_init, +@@ -489,7 +498,7 @@ CAMLexport void caml_startup_code( + caml_section_table_size = section_table_size; + /* Initialize system libraries */ + caml_init_exceptions(); +- caml_sys_init("", argv); ++ caml_sys_init(exe_name, argv); + /* Execute the program */ + caml_debugger(PROGRAM_START); + res = caml_interprete(caml_start_code, caml_code_size); +-- diff --git a/debian/patches/series b/debian/patches/series index 92053886..f37aa5ed 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,3 +9,4 @@ 0009-Declare-primitive-name-table-as-const-char.patch 0010-Avoid-multiple-declarations-in-generated-.c-files-in.patch 0011-Embed-bytecode-in-C-object-when-using-custom.patch +0012-Properly-initialize-executable-name-in-caml_startup_.patch