diff --git a/src/.depend b/src/.depend index 39dcf07d6..dd47f3984 100644 --- a/src/.depend +++ b/src/.depend @@ -1057,7 +1057,6 @@ test.cmo : \ globals.cmi \ fspath.cmi \ fs.cmi \ - fingerprint.cmi \ common.cmi \ test.cmi test.cmx : \ @@ -1518,7 +1517,6 @@ update.cmo : \ fswatch.cmi \ fspath.cmi \ fpcache.cmi \ - fingerprint.cmi \ fileinfo.cmi \ features.cmi \ common.cmi \ @@ -1551,7 +1549,6 @@ update.cmx : \ fswatch.cmx \ fspath.cmx \ fpcache.cmx \ - fingerprint.cmx \ fileinfo.cmx \ features.cmx \ common.cmx \ diff --git a/src/fingerprint.ml b/src/fingerprint.ml index 9164fae31..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 = @@ -86,8 +95,6 @@ let toString md5 = Bytes.to_string string end -let string = Digest.string - let dummy = "" let hash d = diff --git a/src/fingerprint.mli b/src/fingerprint.mli index 45bf54a56..93b3f1793 100644 --- a/src/fingerprint.mli +++ b/src/fingerprint.mli @@ -9,8 +9,6 @@ val m : t Umarshal.t val file : Fspath.t -> Path.local -> t val subfile : Fspath.t -> Int64.t -> Uutil.Filesize.t -> t -val string : string -> t - val toString : t -> string (* This dummy fingerprint is guaranteed small and distinct from all 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 (****) diff --git a/src/test.ml b/src/test.ml index c18310103..41617792c 100644 --- a/src/test.ml +++ b/src/test.ml @@ -156,8 +156,8 @@ let writefs p fs = verbose (fun() -> Util.msg "Writing new test filesystem\n"); let rec loop p = function | File s -> - verbose (fun() -> Util.msg "Writing %s with contents %s (fingerprint %s)\n" - (Fspath.toDebugString p) s (Fingerprint.toString (Fingerprint.string s))); + verbose (fun() -> Util.msg "Writing %s with contents %s\n" + (Fspath.toDebugString p) s); write p s | Link s -> Fs.symlink s p | Dir files -> diff --git a/src/update.ml b/src/update.ml index 08613558a..439167590 100644 --- a/src/update.ml +++ b/src/update.ml @@ -236,7 +236,7 @@ let archiveHash fspath = let thisRoot = thisRootsGlobalName fspath in let r = Prefs.read rootsName in let n = Printf.sprintf "%s;%s;%d" thisRoot r archiveFormat in - let d = Fingerprint.toString (Fingerprint.string n) in + let d = Digest.to_hex (Digest.string n) in debugverbose (fun()-> Util.msg "Archive name is %s; hashcode is %s\n" n d); if Prefs.read showArchiveName then Util.msg "Archive name is %s; hashcode is %s\n" n d; @@ -282,7 +282,7 @@ let archiveName251 fspath (v: archiveVersion): string * string = let thisRoot = thisRootsGlobalName fspath in let r = Prefs.read rootsName in let n = Printf.sprintf "%s;%s;22" thisRoot r in - let d = Fingerprint.toString (Fingerprint.string n) in + let d = Digest.to_hex (Digest.string n) in (String.sub d 0 significantDigits) in let n = archiveHash251 fspath in