Ludo',

On 18/07/17 13:49, Ludovic Courtès wrote:
> What about generating a UUID in a deterministic yet somewhat unique
> fashion along these lines (untested):

Not great, but I can't think of a better way. :-)

> +  (define root-uuid
> +    ;; UUID of the root file system, computed in a deterministic fashion.
> +    (if (string=? "iso9660" file-system-type)
> +        (let ((pad (compose (cut string-pad <> 2 #\0)
> +                            number->string)))
> +          (string->iso9660-uuid
> +           (string-append "1970-01-01-"
> +                          (pad (hash name 24))
> +                          (pad (hash file-system-type 60))
> +                          (pad (hash (operating-system-host-name os) 60)))))
> +        (uint-list->bytevector
> +         (list (hash (string-append file-system-type name)
> +                     (expt 2 64))
> +               (hash (operating-system-host-name os)
> +                     (expt 2 64)))
> +         (endianness little)
> +         8)))
> +

Why not throw SIZE into this mix as well?

When building without ‘--image-size’ (the default nowadays), it's a
function of the exact size of the entire graph and reasonably sensitive
to most kinds of input changes.

> We cannot use the store file name’s hash, unfortunately, because the
> UUID has to be given on the “host side.”

That is unfortunate, but a best-effort heuristic will do.

Kind regards,

T G-R

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to