Hi Maxime, On Wed, 05 Jan 2022 at 11:07, Maxime Devos wrote: > Precisely, in the sense 'auto' means #true in that 'auto' recurses. > But sometimes #true / auto compute a different hash ... [...] > No, when #:recursive? is 'auto' and the file is a directory, it > recurses. When it is 'auto' and the file is a regular file, then > it also recurses, albeit in a trivial way (because regular files don't > contain other files). > > This comment explains that the 'recursive hash' (nar hash) and 'regular > hash' of a regular file are different, that usually you want the > regular hash for regular files, and implies that '#:recursive? auto' > usually does the right thing. > > But if you really want the recursive hash for regular files, then you > can still compute that by setting #:recursive? #true. Thanks for explaining. Hm, my confusion is probably the same as #51307 [1]. 1: Well, I think ’#:recursive?’ is confusing, and ’auto’ too because it is not POLA for a plumbing function, IMHO. Anyway. It is v4 and it is ready to merge. :-) I just propose to replace ’#:recursive?’ by ’#:nar-serializer?’ and a docstring along these lines, --8<---------------cut here---------------start------------->8--- "Compute the hash of FILE with ALGORITHM. If NAR-SERIALIZER? is #true, compute the combined hash (NAR hash) of FILE for which (SELECT? FILE STAT) returns true. If NAR-SERIALIZER? is #false, compute the regular hash using the default serializer. It is meant to be used for a regular file. If NAR-SERIALIZER? is 'auto', when FILE is a directory, compute the combined hash (NAR hash). When FILE is a regular file, compute the regular hash using the default serializer. The option ’auto’ is meant to apply by default the expected hash computation. Symbolic links are not dereferenced unless NAR-SERIALIZER? is false. This procedure must only be used under controlled circumstances; the detection of symbolic links in FILE is racy. --8<---------------cut here---------------end--------------->8--- WDYT? >> > +  (if (or (eq? recursive? #true) >> > +          (and (eq? recursive? 'auto) >> >> …the symbol ’auto’ is only used here.  IIRC all the series. :-) > > In ‘[PATCH v4 3/4] refresh: Support non-tarball sources.’, there's > >> + (let ((hash (file-hash* output))) > > There, #:recursive? is 'auto'. Naive questions: Is it mandatory? Or can be explicitly set? (I have nothing against, just to me ’auto’ is somehow ambiguous and «In the face of ambiguity, refuse the temptation to guess» as ’pyhon3 -c 'import this'’ says ;-)) Cheers, simon