Skip to content

Commit d319f05

Browse files
committed
Only run codesign if there have been substitutions
This ensures that we're not running `codesign` in cases we don't strictly need it. This in turn prevents a regression in macos+nix, where the codesign binary is not in PATH. Closes ocaml#6226 Signed-off-by: Etienne Millon <me@emillon.org>
1 parent 65594df commit d319f05

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

CHANGES.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
Coq's standard library by including `(stdlib no)`.
8080
(#6165 #6164, fixes #6163, @ejgallego @Alizter @LasseBlaauwbroek)
8181

82-
- on macOS, sign executables produced by artifact substitution (#6137, fixes
83-
#5650, @emillon)
82+
- on macOS, sign executables produced by artifact substitution (#6137, #6231,
83+
fixes #5650, fixes #6226, @emillon)
8484

8585
- Added an (aliases ...) field to the (rules ...) stanza which allows the
8686
specification of multiple aliases per rule (#6194, @Alizter)

src/dune_rules/artifact_substitution.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,10 @@ let copy_file_non_atomic ~conf ?chmod ~src ~dst () =
568568
Fiber.return ())
569569
(fun () -> copy ~conf ~input_file:src ~input:(input ic) ~output:(output oc))
570570

571-
let run_sign_hook conf file =
572-
match conf.sign_hook with
573-
| Some hook -> hook file
574-
| None -> Fiber.return ()
571+
let run_sign_hook conf ~has_subst file =
572+
match (conf.sign_hook, has_subst) with
573+
| Some hook, true -> hook file
574+
| _ -> Fiber.return ()
575575

576576
(** This is just an optimisation: skip the renaming if the destination exists
577577
and has the right digest. The optimisation is useful to avoid unnecessary
@@ -611,10 +611,10 @@ let copy_file ~conf ?chmod ?(delete_dst_if_it_is_a_directory = false) ~src ~dst
611611
Fiber.finalize
612612
(fun () ->
613613
let open Fiber.O in
614-
let* (_ : bool) =
614+
let* has_subst =
615615
copy_file_non_atomic ~conf ?chmod ~src ~dst:temp_file ()
616616
in
617-
let+ () = run_sign_hook conf temp_file in
617+
let+ () = run_sign_hook conf ~has_subst temp_file in
618618
replace_if_different ~delete_dst_if_it_is_a_directory ~src:temp_file ~dst)
619619
~finally:(fun () ->
620620
Path.unlink_no_err temp_file;

0 commit comments

Comments
 (0)