From 19658b212a3dac78f10b138ae55ae6fb9e0b2287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5ivo=20Leedj=C3=A4rv?= Date: Tue, 26 Sep 2023 15:23:45 +0200 Subject: [PATCH] Move [System.fingerprint] to Fingerprint module This function being in the System module seems to be a simple mishap. --- src/fingerprint.ml | 11 ++++++++++- src/fs.ml | 2 -- src/system/system_generic.ml | 12 ------------ src/system/system_intf.ml | 1 - 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/fingerprint.ml b/src/fingerprint.ml index 981b81048..1989c59c8 100644 --- a/src/fingerprint.ml +++ b/src/fingerprint.ml @@ -34,7 +34,16 @@ let file fspath path = let f = Fspath.concat fspath path in Util.convertUnixErrorsToTransient ("digesting " ^ Fspath.toPrintString f) - (fun () -> Fs.fingerprint f) + (fun () -> + let ic = Fs.open_in_bin f in + try + let d = Digest.channel ic (-1) in + close_in ic; + d + with e -> + close_in_noerr ic; + raise e + ) let maxLength = Uutil.Filesize.ofInt max_int let subfile path offset len = diff --git a/src/fs.ml b/src/fs.ml index 8a1485232..071807941 100644 --- a/src/fs.ml +++ b/src/fs.ml @@ -84,8 +84,6 @@ let acl_set_text f acl = System.acl_set_text (path f) acl (****) -let fingerprint f = System.fingerprint (path f) - let hasInodeNumbers () = System.hasInodeNumbers () let hasSymlink () = System.hasSymlink () let hasCorrectCTime = System.hasCorrectCTime diff --git a/src/system/system_generic.ml b/src/system/system_generic.ml index a7580cfc7..fd1a52c22 100644 --- a/src/system/system_generic.ml +++ b/src/system/system_generic.ml @@ -127,18 +127,6 @@ let has_stderr ~info:_ = true (****) -let fingerprint f = - let ic = open_in_bin f in - try - let d = Digest.channel ic (-1) in - close_in ic; - d - with e -> - close_in_noerr ic; - raise e - -(****) - exception XattrNotSupported let _ = Callback.register_exception "XattrNotSupported" XattrNotSupported diff --git a/src/system/system_intf.ml b/src/system/system_intf.ml index 873f4ca57..7e76a5fbd 100644 --- a/src/system/system_intf.ml +++ b/src/system/system_intf.ml @@ -41,7 +41,6 @@ val openfile : val open_out_gen : open_flag list -> int -> fspath -> out_channel val open_in_bin : fspath -> in_channel val file_exists : fspath -> bool -val fingerprint : fspath -> Digest.t (****)