On Mon, Jul 08, 2002 at 10:31:47PM +0200, Stefano Zacchiroli wrote: > Anyway to avoid others' lazyness mistake I suggest to patch > ocaml-ldconf so that it output a warning or an error message if > /etc/ocaml/ld.conf isn't in the expected format. I attached a tiny ocaml-ldconf patch that: - put a more verbose comment in /etc/ocaml/ld.conf - by default output more warnings, even if -v switch isn't given, mainly: it output what action is taking place (i.e. feedback on user whises), it output a warning when it encounter a bad formatted line > The bad one: > > the upgrading problem is real and is a bug in dh_ocamlld (I'm going to > submit the bug just after this mail): while upgrading to a new package Never mind, I thought that dh_ocamlld was provided by debhelper, but it's provided by ocaml. So instead of filing the bug I attach another, even more tiny, patch for /usr/share/debhelper/autoscripts/postrm-ocamlld that solve the postrm problem. Anyway please note that we still need a solution for the removal of old spurious entries in /var/lib/ocaml/ld.conf. Cheers. -- Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro "I know you believe you understood what you think I said, but I am not sure you realize that what you heard is not what I meant!" -- G.Romney
--- debian.orig/ocaml-ldconf.ml Mon Jul 8 22:23:05 2002 +++ debian/ocaml-ldconf.ml Mon Jul 8 23:03:52 2002 @@ -39,12 +39,31 @@ let user_ldconf_comment = Printf.sprintf "# # %s +# +# WARNING: if you modify this file remember to invoke +# 'ocaml-ldconf' afterward or your mofidication will not be +# seen by the ocaml tools (compiler, toplevel, ...) +# # This is the system administrator ld.conf file for ocaml # On Debian systems, this file is read by the ocaml-ldconf # tool, together with %s, to generate # the standard ocaml %s file. -# See ocaml-ldconf(1) for more details. # +# File format: +# +# <directory> { add | addafter | remove } +# +# 'add' add the directory to the ocaml shared objects +# search path _before_ dpkg managed ones +# +# 'addafter' add the directory to the ocaml shared objects +# search path _after_ dpkg managed ones +# +# 'remove' remove the directory from the ocaml shared +# objects search path if it's included in the +# dpkg managed ones +# +# See ocaml-ldconf(1) for more details. " user_ldconf dpkg_ldconf ocaml_ldconf let dpkg_ldconf_comment = Printf.sprintf @@ -210,7 +229,7 @@ (* add directories, if those don't already exist for the given package *) let action_add path package = - if !verbose then Printf.printf "%s adds path %s to %s\n" package (string_of_list path) dpkg_ldconf; + Printf.printf "%s adds path %s to %s\n" package (string_of_list path) dpkg_ldconf; let add_list = addpath path package in let contents = read_file_contents dpkg_ldconf in let new_list = sup_list add_list contents in @@ -218,7 +237,7 @@ (* remove directories, if those exist for the given package *) let action_remove path package = - if !verbose then Printf.printf "%s removes path %s to %s\n" package (string_of_list path) dpkg_ldconf; + Printf.printf "%s removes path %s to %s\n" package (string_of_list path) dpkg_ldconf; let remove_list = addpath path package in let contents = read_file_contents dpkg_ldconf in let new_cont = sup_list contents remove_list in @@ -226,7 +245,7 @@ (* display the list of ld.conf directories if those exist *) let action_display () = - if !verbose then Printf.printf "paths found in %s:\n" ocaml_ldconf; + Printf.printf "paths found in %s:\n" ocaml_ldconf; let contents = read_file_contents ocaml_ldconf in let f l = if String.length l > 0 && l.[0] <> '#' then Printf.printf "\t%s\n" l; in @@ -234,7 +253,7 @@ (* update the ocaml_ldconf file *) let action_update () = - if !verbose then Printf.printf "updating %s\n" ocaml_ldconf; + Printf.printf "updating %s\n" ocaml_ldconf; let rec f fd lineno add_list addafter_list ignore_list = let f = f fd (lineno+1) in try let l = input_line fd in @@ -244,14 +263,16 @@ | dir, Remove_action -> f add_list addafter_list (ignore_list@[dir]) | _, Comment_action -> f add_list addafter_list ignore_list | _, _ -> - begin if !verbose then Printf.eprintf "%s:%d: ignore wrong formatted line:\n %s\n" + begin + Printf.eprintf "%s:%d: ignore wrong formatted line:\n %s\n" user_ldconf lineno l end; f add_list addafter_list ignore_list with End_of_file -> close_in fd; add_list, addafter_list, ignore_list in let add_list, addafter_list, ignore_list = try let fd = open_in user_ldconf in f fd 1 [] [] [] with Sys_error s -> - begin if !verbose then Printf.eprintf "Warning, %s not accesible: %s" + begin + Printf.eprintf "Warning, %s not accesible: %s" user_ldconf s end; [], [], [] in let rec f fd lineno dpkg_list = let f = f fd (lineno+1) in try @@ -260,14 +281,14 @@ | _, Comment_action -> f dpkg_list | dir, Add_action -> f (dpkg_list@[dir]) | _, _ -> - begin if !verbose then Printf.eprintf "%s:%d: ignore wrong formatted line:\n %s\n" + begin Printf.eprintf "%s:%d: ignore wrong formatted line:\n %s\n" dpkg_ldconf lineno l end; f dpkg_list with End_of_file -> close_in fd; dpkg_list in let dpkg_list = try let fd = open_in dpkg_ldconf in sup_list (f fd 1 []) ignore_list with Sys_error s -> - begin if !verbose then Printf.eprintf "Warning, %s not accesible: %s" + begin Printf.eprintf "Warning, %s not accesible: %s" dpkg_ldconf s end; [] in write_file_contents ocaml_ldconf (ocaml_ldconf_comment::add_list@dpkg_list@addafter_list)
--- postrm-ocamlld.orig Mon Jul 8 23:09:06 2002 +++ postrm-ocamlld Mon Jul 8 23:15:07 2002 @@ -1,3 +1,10 @@ -if [ "$1" = "remove" -a -x /usr/bin/ocaml-ldconf ]; then - /usr/bin/ocaml-ldconf -p #PACKAGE# -r #DIR# +if [ -x /usr/bin/ocaml-ldconf ]; then + case "$1" in + remove|upgrade) + /usr/bin/ocaml-ldconf -p #PACKAGE# -r #DIR# + ;; + *) + # do nothing + ;; + esac fi
Attachment:
pgpGoB8lx0_XV.pgp
Description: PGP signature