mirage / ocaml-tar

Pure OCaml library to read and write tar files
ISC License
54 stars 34 forks source link

Tar_mirage.digest errors on dictionaries #111

Closed reynir closed 1 year ago

reynir commented 1 year ago

The implementation uses get on the key and then calls Digest.string on the data. get will return Error `Value_expected if the key is a dictionary.

(** [digest t k] is the unique digest of the value bound to [k] in
    [t].
    When the value bound to [k] is a dictionary, the digest is a
    unique and deterministic digest of its entries. *)

https://github.com/mirage/mirage-kv/blob/main/src/mirage_kv.mli#L167-L172

This suggests we need to compute a digest recursively from the children of the dictionary. I don't like this much. It is good however to document the divergence from the interface.

hannesm commented 1 year ago

Maybe we should similar to last_modified, adapt the mirage-kv API to allow such behaviour on dictionaries for digest?

reynir commented 1 year ago

Fixed in mirage-kv 6.1.1