From: Stephane Glondu <steph@glondu.net>
Date: Thu, 13 Jul 2023 09:05:18 +0200
Subject: Fix compilation with recent yojson

Bug-Debian: https://bugs.debian.org/1040537
---
 src/libraries/utils/json.mll | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/libraries/utils/json.mll b/src/libraries/utils/json.mll
index b17e0c8..53cbaec 100644
--- a/src/libraries/utils/json.mll
+++ b/src/libraries/utils/json.mll
@@ -334,10 +334,11 @@ let rec merge_assoc_lists la lb =
   List.rev r
 
 let merge_object path json_root_obj =
+  let path0 = path in
   let open Yojson.Basic.Util in
   let existing_root_obj =
     try
-      match Hashtbl.find json_tbl path with
+      match Hashtbl.find json_tbl path0 with
       | `Assoc _ as root -> root
       | _ -> raise (CannotMerge "JSON root element should be an object")
     with Not_found ->
@@ -347,13 +348,14 @@ let merge_object path json_root_obj =
   let new_assoc = json_root_obj |> to_assoc in
   let merged = merge_assoc_lists existing_assoc new_assoc in
   let merged_obj = `Assoc merged in
-  Hashtbl.replace json_tbl path merged_obj
+  Hashtbl.replace json_tbl path0 merged_obj
 
 let merge_array path json_root_array =
+  let path0 = path in
   let open Yojson.Basic.Util in
   let existing_root_array =
     try
-      match Hashtbl.find json_tbl path with
+      match Hashtbl.find json_tbl path0 with
       | `List _ as root -> root
       | _ -> raise (CannotMerge "JSON root element should be an array")
     with Not_found ->
@@ -362,7 +364,7 @@ let merge_array path json_root_array =
   let existing_list = existing_root_array |> to_list in
   let new_list = json_root_array |> to_list in
   let merged_list = `List (existing_list @ new_list) in
-  Hashtbl.replace json_tbl path merged_list
+  Hashtbl.replace json_tbl path0 merged_list
 
 let flush_cache () =
   let written =
