store: deduplication: Handle fs without d_type support.

scandir* uses readdir, which means that the file type property can be 'unknown
if the underlying file-system does not support d_type. Make sure to fallback
to lstat in that case.

Fixes: https://issues.guix.gnu.org/issue/42579.

* guix/store/deduplication.scm (deduplicate): Handle the case where properties
is 'unknown because the underlying file-system does not support d_type.
This commit is contained in:
Mathieu Othacehe 2020-07-28 14:05:09 +02:00
parent 64e8f2ec2d
commit 8b221b64a5
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
1 changed files with 4 additions and 2 deletions

View File

@ -164,8 +164,10 @@ under STORE."
((file . properties)
(unless (member file '("." ".."))
(let* ((file (string-append path "/" file))
(type (or (assq-ref properties 'type)
(stat:type (lstat file)))))
(type (match (assoc-ref properties 'type)
((or 'unknown #f)
(stat:type (lstat file)))
(type type))))
(loop file type
(and (not (eq? 'directory type))
(nar-sha256 file)))))))