Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ocaml-dune for openSUSE:Factory checked in at 2024-03-13 22:18:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ocaml-dune (Old) and /work/SRC/openSUSE:Factory/.ocaml-dune.new.1770 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ocaml-dune" Wed Mar 13 22:18:18 2024 rev:44 rq:1157388 version:3.14.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ocaml-dune/ocaml-dune.changes 2024-02-20 21:13:55.540916490 +0100 +++ /work/SRC/openSUSE:Factory/.ocaml-dune.new.1770/ocaml-dune.changes 2024-03-13 22:19:19.989940238 +0100 @@ -1,0 +2,6 @@ +Mon Mar 11 11:11:11 UTC 2024 - oher...@suse.de + +- Update to version 3.14.2 + see included CHANGES.md file for details + +------------------------------------------------------------------- Old: ---- ocaml-dune-3.14.0.tar.xz New: ---- ocaml-dune-3.14.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ocaml-dune.spec ++++++ --- /var/tmp/diff_new_pack.Yotfr8/_old 2024-03-13 22:19:21.185984328 +0100 +++ /var/tmp/diff_new_pack.Yotfr8/_new 2024-03-13 22:19:21.201984918 +0100 @@ -25,7 +25,7 @@ %define pkg ocaml-dune %global _buildshell /bin/bash Name: %pkg%nsuffix -Version: 3.14.0 +Version: 3.14.2 Release: 0 %{?ocaml_preserve_bytecode} License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.Yotfr8/_old 2024-03-13 22:19:21.377991406 +0100 +++ /var/tmp/diff_new_pack.Yotfr8/_new 2024-03-13 22:19:21.409992586 +0100 @@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="disabled"> <param name="filename">ocaml-dune</param> - <param name="revision">73250f00372d3f28a25963ded6138728f4202663</param> + <param name="revision">b19f6df8954995899e30275055d9582b6c83687c</param> <param name="scm">git</param> <param name="submodules">disable</param> <param name="url">https://github.com/ocaml/dune.git</param> ++++++ ocaml-dune-3.14.0.tar.xz -> ocaml-dune-3.14.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/CHANGES.md new/ocaml-dune-3.14.2/CHANGES.md --- old/ocaml-dune-3.14.0/CHANGES.md 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/CHANGES.md 2024-03-12 16:18:40.000000000 +0100 @@ -1,3 +1,32 @@ +3.14.2 (2024-03-12) +------------------- + +### Fixed + +- fix compilation on non-glibc systems due to `signal.h` not being pulled in + spawn stubs. (#10256, @emillon) + +3.14.1 (2024-03-11) +------------------- + +### Fixed + +- When a directory is changed to a file, correctly remove it in subsequent + `dune build` runs. (#9327, fix #6575, @emillon) + +- Fix a problem with the doc-new target where transitive dependencies were + missed during compile. This leads to missing expansions in the output docs. + (#9955, @jonludlam) + +- coq: fix performance regression in coqdep unescaping (#10115, fixes #10088, + @ejgallego, thanks to Dan Christensen for the report) + +- coq: memoize coqdep parsing, this will reduce build times for Coq users, in + particular for those with many .v files (#10116, @ejgallego, see also #10088) + +- on Windows, use an unicode-aware version of `CreateProcess` to avoid crashes + when paths contains non-ascii characters. (#10212, fixes #10180, @emillon) + 3.14.0 (2024-02-12) ------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/bin/install_uninstall.ml new/ocaml-dune-3.14.2/bin/install_uninstall.ml --- old/ocaml-dune-3.14.0/bin/install_uninstall.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/bin/install_uninstall.ml 2024-03-12 16:18:40.000000000 +0100 @@ -363,7 +363,7 @@ if Path.exists dst then ( print_line "Deleting %s" (Path.to_string_maybe_quoted dst); - print_unix_error (fun () -> Path.unlink dst)) + print_unix_error (fun () -> Path.unlink_exn dst)) ;; let remove_dir_if_exists ~if_non_empty dir = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/boot/duneboot.ml new/ocaml-dune-3.14.2/boot/duneboot.ml --- old/ocaml-dune-3.14.0/boot/duneboot.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/boot/duneboot.ml 2024-03-12 16:18:40.000000000 +0100 @@ -1067,6 +1067,7 @@ ~ocaml_config ~dependencies ~c_files + ~build_flags ~link_flags { target = name, main; external_libraries; _ } = @@ -1114,7 +1115,7 @@ Process.run ~cwd:build_dir Config.compiler - (List.concat [ [ "-c"; "-g" ]; external_includes; [ file ] ]) + (List.concat [ [ "-c"; "-g" ]; external_includes; build_flags; [ file ] ]) >>| fun () -> Filename.chop_extension file ^ ext_obj)) >>= fun obj_files -> let compiled_ml_ext = @@ -1151,6 +1152,12 @@ and clear dir = List.iter (readdir dir) ~f:rm_rf +let get_flags ocaml_system flags = + match List.assoc_opt ocaml_system flags with + | None -> [] + | Some flags -> flags +;; + (** {2 Bootstrap process} *) let main () = (try clear build_dir with @@ -1164,15 +1171,14 @@ let c_files = List.map ~f:(fun (_, _, c_files) -> c_files) libraries |> List.concat in get_dependencies libraries >>= fun dependencies -> - let link_flags = + let ocaml_system = match StringMap.find_opt "system" ocaml_config with | None -> assert false - | Some platform -> - (match List.assoc_opt platform Libs.link_flags with - | None -> [] - | Some flags -> flags) + | Some s -> s in - build ~ocaml_config ~dependencies ~c_files ~link_flags task + let build_flags = get_flags ocaml_system Libs.build_flags in + let link_flags = get_flags ocaml_system Libs.link_flags in + build ~ocaml_config ~dependencies ~c_files ~build_flags ~link_flags task ;; let () = Fiber.run (main ()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/boot/libs.ml new/ocaml-dune-3.14.2/boot/libs.ml --- old/ocaml-dune-3.14.0/boot/libs.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/boot/libs.ml 2024-03-12 16:18:40.000000000 +0100 @@ -97,6 +97,13 @@ ; ("src/dune_rules_rpc", Some "Dune_rules_rpc", false, None) ] +let build_flags = + [ ("win32", [ "-ccopt"; "-D_UNICODE"; "-ccopt"; "-DUNICODE" ]) + ; ("win64", [ "-ccopt"; "-D_UNICODE"; "-ccopt"; "-DUNICODE" ]) + ; ("mingw", [ "-ccopt"; "-D_UNICODE"; "-ccopt"; "-DUNICODE" ]) + ; ("mingw64", [ "-ccopt"; "-D_UNICODE"; "-ccopt"; "-DUNICODE" ]) + ] + let link_flags = [ ("macosx", [ "-cclib" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/ocaml-dune.changes new/ocaml-dune-3.14.2/ocaml-dune.changes --- old/ocaml-dune-3.14.0/ocaml-dune.changes 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/ocaml-dune.changes 2024-03-12 16:18:40.000000000 +0100 @@ -1354,3 +1354,9 @@ e0bd14d15 doc: split actions pages (#9949) c866e1d64 (tag: 3.14.0_alpha1) chore: prepare 3.14.0~alpha1 (#9953) 73250f003 (tag: 3.14.0, origin/3.14) chore: prepare 3.14.0 (#9976) +10e01558c fix(engine): remove old target even if it is a dir (#9327) (#10204) +f83559cb4 [3.14] backport #9955 (#10205) +41d9f3c8b fix(coq): Fix performance regression in coqdep unescaping (#10206) +08c5ec21a [coq] Memoize coqdep parsing (#10207) +220d32ffb fix(windows): use unicode version of CreateProcess (#10212) (#10246) +3f4cdafa7 (tag: 3.14.1, origin/3.14) [3.14] Prepare changelog for 3.14.1 release (#10249) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/otherlibs/stdune/src/fpath.ml new/ocaml-dune-3.14.2/otherlibs/stdune/src/fpath.ml --- old/ocaml-dune-3.14.0/otherlibs/stdune/src/fpath.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/otherlibs/stdune/src/fpath.ml 2024-03-12 16:18:40.000000000 +0100 @@ -113,10 +113,29 @@ | _ -> raise e) ;; -let unlink = if Stdlib.Sys.win32 then win32_unlink else Unix.unlink +let unlink_exn = if Stdlib.Sys.win32 then win32_unlink else Unix.unlink + +type unlink_status = + | Success + | Does_not_exist + | Is_a_directory + | Error of exn + +let unlink t = + match unlink_exn t with + | () -> Success + | exception exn -> + (match exn with + | Unix.Unix_error (ENOENT, _, _) -> Does_not_exist + | Unix.Unix_error (error, _, _) -> + (match error, Platform.OS.value with + | EISDIR, _ | EPERM, Darwin -> Is_a_directory + | _ -> Error exn) + | _ -> Error exn) +;; let unlink_no_err t = - try unlink t with + try unlink_exn t with | _ -> () ;; @@ -157,7 +176,7 @@ match Unix.lstat fn with | exception Unix.Unix_error (ENOENT, _, _) -> () | { Unix.st_kind = S_DIR; _ } -> rm_rf_dir fn - | _ -> unlink fn + | _ -> unlink_exn fn ;; let traverse_files = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/otherlibs/stdune/src/fpath.mli new/ocaml-dune-3.14.2/otherlibs/stdune/src/fpath.mli --- old/ocaml-dune-3.14.0/otherlibs/stdune/src/fpath.mli 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/otherlibs/stdune/src/fpath.mli 2024-03-12 16:18:40.000000000 +0100 @@ -27,8 +27,18 @@ [Error Max_depth_exceeded] on some intermediate path). *) val follow_symlinks : string -> string option -val unlink : string -> unit +val unlink_exn : string -> unit val unlink_no_err : string -> unit + +type unlink_status = + | Success + | Does_not_exist + | Is_a_directory + | Error of exn + +(** Unlink and return error, if any. *) +val unlink : string -> unlink_status + val initial_cwd : string type clear_dir_result = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/otherlibs/stdune/src/io.ml new/ocaml-dune-3.14.2/otherlibs/stdune/src/io.ml --- old/ocaml-dune-3.14.0/otherlibs/stdune/src/io.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/otherlibs/stdune/src/io.ml 2024-03-12 16:18:40.000000000 +0100 @@ -500,7 +500,7 @@ destination (we also do this in the symlink case above). Perhaps, the list of dependencies may have duplicates? If yes, it may be better to filter out the duplicates first. *) - Path.unlink dst; + Path.unlink_exn dst; Path.link src dst | Unix.Unix_error (Unix.EMLINK, _, _) -> (* If we can't make a new hard link because we reached the limit on the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/otherlibs/stdune/src/path.ml new/ocaml-dune-3.14.2/otherlibs/stdune/src/path.ml --- old/ocaml-dune-3.14.0/otherlibs/stdune/src/path.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/otherlibs/stdune/src/path.ml 2024-03-12 16:18:40.000000000 +0100 @@ -734,6 +734,7 @@ let of_local t = t let chmod t ~mode = Unix.chmod (to_string t) mode let lstat t = Unix.lstat (to_string t) + let unlink t = Fpath.unlink (to_string t) let unlink_no_err t = Fpath.unlink_no_err (to_string t) let to_dyn s = Dyn.variant "In_build_dir" [ to_dyn s ] end @@ -1134,7 +1135,7 @@ ;; let rmdir t = Unix.rmdir (to_string t) -let unlink t = Fpath.unlink (to_string t) +let unlink_exn t = Fpath.unlink_exn (to_string t) let link src dst = match Unix.link (to_string src) (to_string dst) with diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/otherlibs/stdune/src/path.mli new/ocaml-dune-3.14.2/otherlibs/stdune/src/path.mli --- old/ocaml-dune-3.14.0/otherlibs/stdune/src/path.mli 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/otherlibs/stdune/src/path.mli 2024-03-12 16:18:40.000000000 +0100 @@ -195,6 +195,7 @@ val chmod : t -> mode:int -> unit val lstat : t -> Unix.stats + val unlink : t -> Fpath.unlink_status val unlink_no_err : t -> unit module Table : Hashtbl.S with type key = t @@ -356,7 +357,7 @@ val is_directory : t -> bool val rmdir : t -> unit -val unlink : t -> unit +val unlink_exn : t -> unit val unlink_no_err : t -> unit val link : t -> t -> unit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/dune_engine/action_exec.ml new/ocaml-dune-3.14.2/src/dune_engine/action_exec.ml --- old/ocaml-dune-3.14.0/src/dune_engine/action_exec.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/dune_engine/action_exec.ml 2024-03-12 16:18:40.000000000 +0100 @@ -445,7 +445,7 @@ let remove_intermediate_file () = if optional then ( - try Path.unlink (Path.build file2) with + try Path.unlink_exn (Path.build file2) with | Unix.Unix_error (ENOENT, _, _) -> ()) in if diff_eq_files diff diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/dune_engine/build_system.ml new/ocaml-dune-3.14.2/src/dune_engine/build_system.ml --- old/ocaml-dune-3.14.0/src/dune_engine/build_system.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/dune_engine/build_system.ml 2024-03-12 16:18:40.000000000 +0100 @@ -567,10 +567,27 @@ in let* () = maybe_async_rule_file_op (fun () -> + let remove_target_dir dir = Path.rm_rf (Path.build dir) in + let remove_target_file path = + match Path.Build.unlink path with + | Success -> () + | Does_not_exist -> () + | Is_a_directory -> + (* If target changed from a directory to a file, delete + in anyway. *) + remove_target_dir path + | Error exn -> + Log.info + [ Pp.textf + "Error while removing target %s: %s" + (Path.Build.to_string path) + (Printexc.to_string exn) + ] + in Targets.Validated.iter targets - ~file:Path.Build.unlink_no_err - ~dir:(fun dir -> Path.rm_rf (Path.build dir))) + ~file:remove_target_file + ~dir:remove_target_dir) in let* produced_targets, dynamic_deps_stages = (* Step III. Try to restore artifacts from the shared cache. *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/dune_engine/load_rules.ml new/ocaml-dune-3.14.2/src/dune_engine/load_rules.ml --- old/ocaml-dune-3.14.0/src/dune_engine/load_rules.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/dune_engine/load_rules.ml 2024-03-12 16:18:40.000000000 +0100 @@ -205,7 +205,7 @@ match kind with | Unix.S_DIR -> if not (Subdir_set.mem subdirs_to_keep fn) then Path.rm_rf (Path.build path) - | _ -> Path.unlink (Path.build path))) + | _ -> Path.unlink_exn (Path.build path))) ;; (* We don't remove files in there as we don't know upfront if they are stale or diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/dune_engine/process.ml new/ocaml-dune-3.14.2/src/dune_engine/process.ml --- old/ocaml-dune-3.14.0/src/dune_engine/process.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/dune_engine/process.ml 2024-03-12 16:18:40.000000000 +0100 @@ -853,7 +853,7 @@ let+ process_info, termination_reason = Scheduler.wait_for_build_process pid ~is_process_group_leader:true in - Option.iter response_file ~f:Path.unlink; + Option.iter response_file ~f:Path.unlink_exn; process_info, termination_reason ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/dune_rules/bootstrap_info.ml new/ocaml-dune-3.14.2/src/dune_rules/bootstrap_info.ml --- old/ocaml-dune-3.14.0/src/dune_rules/bootstrap_info.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/dune_rules/bootstrap_info.ml 2024-03-12 16:18:40.000000000 +0100 @@ -15,6 +15,9 @@ | Some x -> Left x | None -> Right lib) in + let windows_system_values = [ "win32"; "win64"; "mingw"; "mingw64" ] in + let win_build_flags = [ "-ccopt"; "-D_UNICODE"; "-ccopt"; "-DUNICODE" ] in + let build_flags = List.map windows_system_values ~f:(fun f -> f, win_build_flags) in let link_flags = let win_link_flags = [ "-cclib"; "-lshell32"; "-cclib"; "-lole32"; "-cclib"; "-luuid" ] @@ -22,12 +25,9 @@ (* additional link flags keyed by the platform *) [ ( "macosx" , [ "-cclib"; "-framework CoreFoundation"; "-cclib"; "-framework CoreServices" ] ) - ; "win32", win_link_flags - ; "win64", win_link_flags - ; "mingw", win_link_flags - ; "mingw64", win_link_flags - ; "beos", [ "-cclib"; "-lbsd" ] (* flags for Haiku *) ] + @ List.map windows_system_values ~f:(fun w -> w, win_link_flags) + @ [ "beos", [ "-cclib"; "-lbsd" ] (* flags for Haiku *) ] in let+ locals = Memo.parallel_map locals ~f:(fun x -> @@ -84,6 +84,11 @@ ; def "local_libraries" (List locals) ; Pp.nop ; def + "build_flags" + (let open Dyn in + list (pair string (list string)) build_flags) + ; Pp.nop + ; def "link_flags" (let open Dyn in list (pair string (list string)) link_flags) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/dune_rules/coq/coq_rules.ml new/ocaml-dune-3.14.2/src/dune_rules/coq/coq_rules.ml --- old/ocaml-dune-3.14.0/src/dune_rules/coq/coq_rules.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/dune_rules/coq/coq_rules.ml 2024-03-12 16:18:40.000000000 +0100 @@ -519,7 +519,8 @@ Note that coqdep escapes a few more things, including spaces, $, #, [], ?, %, homedir... How to handle that seems tricky. *) -let unescape_coqdep string = Re.replace_string (Re.compile (Re.str "\\:")) ~by:":" string +let escaped_colon = Re.compile (Re.str "\\:") +let unescape_coqdep string = Re.replace_string escaped_colon ~by:":" string let parse_line ~dir line = match String.lsplit2 line ~on:':' with @@ -563,6 +564,26 @@ ] ;; +(* EJGA: Would be nice to have a functor in [Stdune.Tuple] to do this *) +module DWInput : Memo.Input with type t = Path.Build.t * string = struct + type t = Path.Build.t * string + + let hash = Tuple.T2.hash Path.Build.hash String.hash + let equal = Tuple.T2.equal Path.Build.equal String.equal + let to_dyn = Tuple.T2.to_dyn Path.Build.to_dyn String.to_dyn +end + +(* EJGA: with this code, we have a combined memo node that will be + re-executed iff [dir], [wrapper_name], or the deps of the original + action builder (the [.v.d] file from [dep_theory_file ~dir + ~wrapper_name]) change *) +let memo_get_dep_map = + Action_builder.create_memo + "coq_dep_map" + ~input:(module DWInput) + (fun (dir, wrapper_name) -> get_dep_map ~dir ~wrapper_name) +;; + let deps_of ~dir ~boot_type ~wrapper_name ~mode coq_module = let open Action_builder.O in let vo_target = @@ -573,7 +594,7 @@ in Path.set_extension ~ext (Coq_module.source coq_module) in - let* dep_map = get_dep_map ~dir ~wrapper_name in + let* dep_map = Action_builder.exec_memo memo_get_dep_map (dir, wrapper_name) in match Dep_map.find dep_map vo_target with | None -> Code_error.raise diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/dune_rules/odoc_new.ml new/ocaml-dune-3.14.2/src/dune_rules/odoc_new.ml --- old/ocaml-dune-3.14.0/src/dune_rules/odoc_new.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/dune_rules/odoc_new.ml 2024-03-12 16:18:40.000000000 +0100 @@ -907,7 +907,7 @@ require all of the odoc files for all dependency libraries to be created rather than doing any fine-grained dependency management. *) let compile_requires stdlib_opt libs = - Memo.List.map ~f:Lib.requires libs + Memo.List.map ~f:(fun l -> Lib.closure ~linking:false [ l ]) libs >>| Resolve.all >>| Resolve.map ~f:(fun requires -> let requires = List.flatten requires in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/dune_rules/pkg_rules.ml new/ocaml-dune-3.14.2/src/dune_rules/pkg_rules.ml --- old/ocaml-dune-3.14.0/src/dune_rules/pkg_rules.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/dune_rules/pkg_rules.ml 2024-03-12 16:18:40.000000000 +0100 @@ -1327,7 +1327,7 @@ section, file) |> Section.Map.of_list_multi in - let+ () = Async.async (fun () -> Path.unlink install_file) in + let+ () = Async.async (fun () -> Path.unlink_exn install_file) in map in (* TODO we should make sure that overwrites aren't allowed *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/src/upgrader/dune_upgrader.ml new/ocaml-dune-3.14.2/src/upgrader/dune_upgrader.ml --- old/ocaml-dune-3.14.0/src/upgrader/dune_upgrader.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/src/upgrader/dune_upgrader.ml 2024-03-12 16:18:40.000000000 +0100 @@ -396,7 +396,7 @@ (Path.Source.to_string_maybe_quoted new_file) ]; List.iter (original_file :: extra_files_to_delete) ~f:(fun p -> - Path.unlink (Path.source p)); + Path.unlink_exn (Path.source p)); Io.write_file (Path.source new_file) contents ~binary:true); if !v1_updates && not last then ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/github6575.t new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/github6575.t --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/github6575.t 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/github6575.t 2024-03-12 16:18:40.000000000 +0100 @@ -12,13 +12,14 @@ $ mv sometest.t.bak/run.t sometest.t $ rm -r sometest.t.bak -FIXME: Dune should detect the change: +Dune detects the change: $ dune build @sometest - Error: _build/default/sometest.t: Is a directory - -> required by _build/default/sometest.t - -> required by alias sometest - [1] -After a clean it works as expected: - $ dune clean +The other way. Turn the file test into a directory test: + + $ mv sometest.t sometest.t.bak + $ mkdir sometest.t + $ mv sometest.t.bak sometest.t/run.t + +And this works: $ dune build @sometest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/c.ml new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/c.ml --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/c.ml 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/c.ml 2024-03-12 16:18:40.000000000 +0100 @@ -0,0 +1 @@ +module type S = module type of B.A diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/dune new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/dune --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/dune 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/dune 2024-03-12 16:18:40.000000000 +0100 @@ -0,0 +1,4 @@ +(library + (public_name odoctest3) + (libraries odoctest3.sublib2)) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/dune-project new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/dune-project --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/dune-project 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/dune-project 2024-03-12 16:18:40.000000000 +0100 @@ -0,0 +1 @@ +(lang dune 3.0) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/run.t new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/run.t --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/run.t 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/run.t 2024-03-12 16:18:40.000000000 +0100 @@ -0,0 +1,9 @@ +This test checks that compilation dependencies are correct + + $ dune build @doc-new + +There should be an expansion of S: + + $ ls _build/default/_doc_new/html/docs/local/odoctest3/Odoctest3/C/ + index.html + module-type-S diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib1/a.ml new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib1/a.ml --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib1/a.ml 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib1/a.ml 2024-03-12 16:18:40.000000000 +0100 @@ -0,0 +1 @@ +type t = int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib1/dune new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib1/dune --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib1/dune 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib1/dune 2024-03-12 16:18:40.000000000 +0100 @@ -0,0 +1,4 @@ +(library + (name sublib1) + (wrapped false) + (public_name odoctest3.sublib1)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib2/b.ml new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib2/b.ml --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib2/b.ml 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib2/b.ml 2024-03-12 16:18:40.000000000 +0100 @@ -0,0 +1,2 @@ +module A = A + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib2/dune new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib2/dune --- old/ocaml-dune-3.14.0/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib2/dune 1970-01-01 01:00:00.000000000 +0100 +++ new/ocaml-dune-3.14.2/test/blackbox-tests/test-cases/odoc/new/transitive-compile-deps.t/sublib2/dune 2024-03-12 16:18:40.000000000 +0100 @@ -0,0 +1,6 @@ +(library + (name sublib2) + (wrapped false) + (public_name odoctest3.sublib2) + (libraries sublib1)) + \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/vendor/spawn/src/dune new/ocaml-dune-3.14.2/vendor/spawn/src/dune --- old/ocaml-dune-3.14.0/vendor/spawn/src/dune 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/vendor/spawn/src/dune 2024-03-12 16:18:40.000000000 +0100 @@ -2,5 +2,24 @@ (name spawn) (foreign_stubs (language c) + (flags (:standard (:include flags.sexp))) (names spawn_stubs)) (libraries unix threads.posix)) + +(rule + (target flags.sexp) + (enabled_if + (= %{os_type} "Win32")) + (action + (with-stdout-to + %{target} + (echo "(-DUNICODE -D_UNICODE)")))) + +(rule + (target flags.sexp) + (enabled_if + (<> %{os_type} "Win32")) + (action + (with-stdout-to + %{target} + (echo "()")))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/vendor/spawn/src/spawn.ml new/ocaml-dune-3.14.2/vendor/spawn/src/spawn.ml --- old/ocaml-dune-3.14.0/vendor/spawn/src/spawn.ml 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/vendor/spawn/src/spawn.ml 2024-03-12 16:18:40.000000000 +0100 @@ -28,12 +28,20 @@ unsuccessful. In the end we decided not to default to [vfork] on OSX. *) - if is_osx then - Fork - else - Vfork + if is_osx then Fork else Vfork + ;; end +let no_null s = + if String.contains s '\000' + then + Printf.ksprintf + invalid_arg + "Spawn.Env.of_list: NUL bytes are not allowed in the environment but found one in \ + %S" + s +;; + module type Env = sig type t @@ -44,36 +52,30 @@ type t = string let of_list env = - let len = - List.fold_left env ~init:1 ~f:(fun acc s -> acc + String.length s + 1) - in - let buf = Buffer.create len in - List.iter env ~f:(fun s -> + if env = [] + then "\000\000" + else ( + let len = List.fold_left env ~init:1 ~f:(fun acc s -> acc + String.length s + 1) in + let buf = Buffer.create len in + List.iter env ~f:(fun s -> + no_null s; Buffer.add_string buf s; Buffer.add_char buf '\000'); - Buffer.add_char buf '\000'; - Buffer.contents buf + Buffer.add_char buf '\000'; + Buffer.contents buf) + ;; end module Env_unix : Env = struct type t = string list - let no_null s = - if String.contains s '\000' then - Printf.ksprintf invalid_arg - "Spawn.Env.of_list: NUL bytes are not allowed in the environment but \ - found one in %S" - s - let of_list l = List.iter l ~f:no_null; l + ;; end -module Env : Env = (val if Sys.win32 then - (module Env_win32) - else - (module Env_unix) : Env) +module Env : Env = (val if Sys.win32 then (module Env_win32) else (module Env_unix) : Env) module Pgid = struct type t = int @@ -81,17 +83,13 @@ let new_process_group = 0 let of_pid = function - | 0 -> - raise (Invalid_argument "bad pid: 0 (hint: use [Pgid.new_process_group])") - | t -> - if t < 0 then - raise (Invalid_argument ("bad pid: " ^ string_of_int t)) - else - t + | 0 -> raise (Invalid_argument "bad pid: 0 (hint: use [Pgid.new_process_group])") + | t -> if t < 0 then raise (Invalid_argument ("bad pid: " ^ string_of_int t)) else t + ;; end -external spawn_unix : - env:Env.t option +external spawn_unix + : env:Env.t option -> cwd:Working_dir.t -> prog:string -> argv:string list @@ -101,29 +99,38 @@ -> use_vfork:bool -> setpgid:int option -> sigprocmask:(Unix.sigprocmask_command * int list) option - -> int = "spawn_unix_byte" "spawn_unix" + -> int + = "spawn_unix_byte" "spawn_unix" -external spawn_windows : - env:Env.t option +external spawn_windows + : env:Env.t option -> cwd:string option -> prog:string -> cmdline:string -> stdin:Unix.file_descr -> stdout:Unix.file_descr -> stderr:Unix.file_descr - -> int = "spawn_windows_byte" "spawn_windows" + -> int + = "spawn_windows_byte" "spawn_windows" let maybe_quote f = - if - String.contains f ' ' || String.contains f '\"' || String.contains f '\t' - || f = "" - then - Filename.quote f - else - f - -let spawn_windows ~env ~cwd ~prog ~argv ~stdin ~stdout ~stderr ~use_vfork:_ - ~setpgid:_ ~sigprocmask:_ = + if String.contains f ' ' || String.contains f '\"' || String.contains f '\t' || f = "" + then Filename.quote f + else f +;; + +let spawn_windows + ~env + ~cwd + ~prog + ~argv + ~stdin + ~stdout + ~stderr + ~use_vfork:_ + ~setpgid:_ + ~sigprocmask:_ + = let cwd = match (cwd : Working_dir.t) with | Path p -> Some p @@ -132,48 +139,49 @@ in let cmdline = String.concat (List.map argv ~f:maybe_quote) ~sep:" " in let prog = - match (Filename.is_relative prog, cwd) with + match Filename.is_relative prog, cwd with | true, Some p -> Filename.concat p prog | _ -> prog in spawn_windows ~env ~cwd ~prog ~cmdline ~stdin ~stdout ~stderr +;; let no_null s = - if String.contains s '\000' then - Printf.ksprintf invalid_arg - "Spawn.spawn: NUL bytes are not allowed in any of the arguments but \ - found one in %S" + if String.contains s '\000' + then + Printf.ksprintf + invalid_arg + "Spawn.spawn: NUL bytes are not allowed in any of the arguments but found one in %S" s +;; -let spawn ?env ?(cwd = Working_dir.Inherit) ~prog ~argv ?(stdin = Unix.stdin) - ?(stdout = Unix.stdout) ?(stderr = Unix.stderr) - ?(unix_backend = Unix_backend.default) ?setpgid ?sigprocmask () = +let spawn + ?env + ?(cwd = Working_dir.Inherit) + ~prog + ~argv + ?(stdin = Unix.stdin) + ?(stdout = Unix.stdout) + ?(stderr = Unix.stderr) + ?(unix_backend = Unix_backend.default) + ?setpgid + ?sigprocmask + () + = (match cwd with - | Path s -> no_null s - | Fd _ - | Inherit -> - ()); + | Path s -> no_null s + | Fd _ | Inherit -> ()); no_null prog; List.iter argv ~f:no_null; - let backend = - if Sys.win32 then - spawn_windows - else - spawn_unix - in + let backend = if Sys.win32 then spawn_windows else spawn_unix in let use_vfork = match unix_backend with | Vfork -> true | Fork -> false in - backend ~env ~cwd ~prog ~argv ~stdin ~stdout ~stderr ~use_vfork ~setpgid - ~sigprocmask + backend ~env ~cwd ~prog ~argv ~stdin ~stdout ~stderr ~use_vfork ~setpgid ~sigprocmask +;; external safe_pipe : unit -> Unix.file_descr * Unix.file_descr = "spawn_pipe" -let safe_pipe = - if Sys.win32 then - fun () -> - Unix.pipe ~cloexec:true () - else - safe_pipe +let safe_pipe = if Sys.win32 then fun () -> Unix.pipe ~cloexec:true () else safe_pipe diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/vendor/spawn/src/spawn.mli new/ocaml-dune-3.14.2/vendor/spawn/src/spawn.mli --- old/ocaml-dune-3.14.0/vendor/spawn/src/spawn.mli 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/vendor/spawn/src/spawn.mli 2024-03-12 16:18:40.000000000 +0100 @@ -6,10 +6,10 @@ module Working_dir : sig type t = - | Path of string (** Path in the filesystem *) + | Path of string (** Path in the filesystem *) | Fd of Unix.file_descr (** File descriptor pointing to a directory. Not supported on Windows. *) - | Inherit (** Inherit the working directory of the current process *) + | Inherit (** Inherit the working directory of the current process *) end module Unix_backend : sig @@ -110,8 +110,8 @@ [unix_backend] describes what backend to use on Unix. If set to [Default], [vfork] is used unless the environment variable [SPAWN_USE_FORK] is set. On Windows, [CreateProcess] is used. *) -val spawn : - ?env:Env.t +val spawn + : ?env:Env.t -> ?cwd:Working_dir.t (* default: [Inherit] *) -> prog:string -> argv:string list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/vendor/spawn/src/spawn_stubs.c new/ocaml-dune-3.14.2/vendor/spawn/src/spawn_stubs.c --- old/ocaml-dune-3.14.0/vendor/spawn/src/spawn_stubs.c 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/vendor/spawn/src/spawn_stubs.c 2024-03-12 16:18:40.000000000 +0100 @@ -1,15 +1,30 @@ #define _GNU_SOURCE +/* Must come before any other caml/ headers are included */ +#define CAML_INTERNALS + +#ifdef _WIN32 +/* for [caml_win32_multi_byte_to_wide_char] */ +#include <caml/osdeps.h> + +/* Prior to OCaml 5.0, the function was called win_multi_byte_to_wide_char */ +#include <caml/version.h> +#if OCAML_VERSION_MAJOR < 5 +#define caml_win32_multi_byte_to_wide_char win_multi_byte_to_wide_char +#define caml_win32_maperr win32_maperr +#endif +#endif + #include <caml/mlvalues.h> #include <caml/memory.h> #include <caml/alloc.h> #include <caml/unixsupport.h> #include <caml/fail.h> -#include <errno.h> - +/* for [caml_convert_signal_number]; must come after public caml headers */ #include <caml/signals.h> -CAMLextern int caml_convert_signal_number(int); + +#include <errno.h> #if defined(__APPLE__) @@ -846,31 +861,51 @@ { STARTUPINFO si; PROCESS_INFORMATION pi; + WCHAR *prog; + WCHAR *cmdline; + WCHAR *env = NULL; + WCHAR *cwd = NULL; + BOOL result; ZeroMemory(&si, sizeof(si)); ZeroMemory(&pi, sizeof(pi)); - si.cb = sizeof(si); - si.dwFlags = STARTF_USESTDHANDLES; if (!dup2_and_clear_close_on_exec(v_stdin , &si.hStdInput ) || !dup2_and_clear_close_on_exec(v_stdout, &si.hStdOutput) || !dup2_and_clear_close_on_exec(v_stderr, &si.hStdError )) { - win32_maperr(GetLastError()); + caml_win32_maperr(GetLastError()); close_std_handles(&si); uerror("DuplicateHandle", Nothing); } - if (!CreateProcess(String_val(v_prog), - Bytes_val(v_cmdline), - NULL, - NULL, - TRUE, - 0, - Is_block(v_env) ? Bytes_val(Field(v_env, 0)) : NULL, - Is_block(v_cwd) ? String_val(Field(v_cwd, 0)) : NULL, - &si, - &pi)) { - win32_maperr(GetLastError()); + prog = caml_stat_strdup_to_utf16(String_val(v_prog)); + cmdline = caml_stat_strdup_to_utf16(String_val(v_cmdline)); + + if (Is_block(v_env)) { + v_env = Field(v_env, 0); + mlsize_t len = caml_string_length(v_env); + int size = caml_win32_multi_byte_to_wide_char(String_val(v_env), len, NULL, 0); + env = caml_stat_alloc(size * sizeof(WCHAR)); + caml_win32_multi_byte_to_wide_char(String_val(v_env), len, env, size); + } + + if (Is_block(v_cwd)) + cwd = caml_stat_strdup_to_utf16(String_val(Field(v_cwd, 0))); + + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + + result = + CreateProcess(prog, cmdline, NULL, NULL, TRUE, CREATE_UNICODE_ENVIRONMENT, + env, cwd, &si, &pi); + + caml_stat_free(prog); + caml_stat_free(cmdline); + caml_stat_free(env); + caml_stat_free(cwd); + + if (!result) { + caml_win32_maperr(GetLastError()); close_std_handles(&si); uerror("CreateProcess", Nothing); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ocaml-dune-3.14.0/vendor/update-spawn.sh new/ocaml-dune-3.14.2/vendor/update-spawn.sh --- old/ocaml-dune-3.14.0/vendor/update-spawn.sh 2024-02-12 11:12:19.000000000 +0100 +++ new/ocaml-dune-3.14.2/vendor/update-spawn.sh 2024-03-12 16:18:40.000000000 +0100 @@ -1,6 +1,6 @@ #!/bin/bash -version=e184beb298d9abe0c524a4839bb0bec3d2571282 +version=6c752122070f377c2607f6969a821f166a43bd5e set -e -o pipefail