Skip to content

Commit

Permalink
Revert "fix: only sign executables (ocaml#8361)"
Browse files Browse the repository at this point in the history
This reverts commit ade58ac.
  • Loading branch information
emillon committed Nov 23, 2023
1 parent dad192b commit bd51a49
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bin/install_uninstall.ml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ module File_ops_real (W : sig
=
let chmod = if executable then fun _ -> 0o755 else fun _ -> 0o644 in
match (special_file : Special_file.t option) with
| None -> Artifact_substitution.copy_file ~conf ~executable ~src ~dst ~chmod ()
| None -> Artifact_substitution.copy_file ~conf ~src ~dst ~chmod ()
| Some sf ->
let ic, oc = Io.setup_copy ~chmod ~src ~dst () in
Fiber.finalize
Expand Down
16 changes: 2 additions & 14 deletions src/dune_rules/artifact_substitution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -673,15 +673,7 @@ let replace_if_different ~delete_dst_if_it_is_a_directory ~src ~dst =
if not up_to_date then Path.rename src dst
;;

let copy_file
~conf
?(executable = false)
?chmod
?(delete_dst_if_it_is_a_directory = false)
~src
~dst
()
=
let copy_file ~conf ?chmod ?(delete_dst_if_it_is_a_directory = false) ~src ~dst () =
(* We create a temporary file in the same directory to ensure it's on the same
partition as [dst] (otherwise, [Path.rename temp_file dst] won't work). The
prefix ".#" is used because Dune ignores such files and so creating this
Expand All @@ -696,11 +688,7 @@ let copy_file
let open Fiber.O in
Path.parent dst |> Option.iter ~f:Path.mkdir_p;
let* has_subst = copy_file_non_atomic ~conf ?chmod ~src ~dst:temp_file () in
let+ () =
if executable
then Conf.run_sign_hook conf ~has_subst temp_file
else Fiber.return ()
in
let+ () = Conf.run_sign_hook conf ~has_subst temp_file in
replace_if_different ~delete_dst_if_it_is_a_directory ~src:temp_file ~dst)
~finally:(fun () ->
Path.unlink_no_err temp_file;
Expand Down
1 change: 0 additions & 1 deletion src/dune_rules/artifact_substitution.mli
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ val decode : string -> t option
and then atomically renamed to [dst]. *)
val copy_file
: conf:Conf.t
-> ?executable:bool
-> ?chmod:(int -> int)
-> ?delete_dst_if_it_is_a_directory:bool
-> src:Path.t
Expand Down

0 comments on commit bd51a49

Please sign in to comment.