Commit 8ee51ee39603d8a1117c471e6660bf605c7d6b3a re-scans for the
available scripts when running certain phases; OTOH, some of them may be
missing, usually due to the lack of scripts for that phase in the
selected set of elements.
Indeed, if there is no directory for a phase, safely raise Not_found so
the case is handled as if the phase was missing in the final_hooks
Hashtbl.
---
dib/dib.ml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dib/dib.ml b/dib/dib.ml
index d15cd19..bcb81c0 100644
--- a/dib/dib.ml
+++ b/dib/dib.ml
@@ -649,7 +649,12 @@ let main () =
*)
match hook with
| "pre-install.d" | "install.d" | "post-install.d"
| "finalise.d" ->
- load_scripts g ("/tmp/aux/hooks/" ^ hook)
+ let scripts_path = "/tmp/aux/hooks/" ^ hook in
+ (* Cleanly handle cases when the phase directory does not exist. *)
+ if g#is_dir ~followsymlinks:true scripts_path then
+ load_scripts g scripts_path
+ else
+ raise Not_found
| _ ->
Hashtbl.find final_hooks hook in
if debug >= 1 then (
--
2.9.3