The following commit has been merged in the master branch:
commit a6112e9953f49452dfc9e9ebd2fd972e8435b2d2
Author: Stephane Glondu <st...@glondu.net>
Date:   Tue May 24 12:27:34 2011 +0200

    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 0000000..2106754
--- /dev/null
+++ 
b/debian/patches/0012-Properly-initialize-executable-name-in-caml_startup_.patch
@@ -0,0 +1,47 @@
+From: Stephane Glondu <st...@glondu.net>
+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 <st...@glondu.net>
+---
+ 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 9205388..f37aa5e 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

-- 
OCaml packaging

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to