diff --git a/guix/build/union.scm b/guix/build/union.scm index 1b09da4..6e2b296 100644 --- a/guix/build/union.scm +++ b/guix/build/union.scm @@ -103,8 +103,13 @@ single leaf." (leaf leaf)))) (define (file=? file1 file2) - "Return #t if the contents of FILE1 and FILE2 are identical, #f otherwise." - (and (= (stat:size (stat file1)) (stat:size (stat file2))) + "Return #t if FILE1 and FILE2 are regular files and their contents are +identical, #f otherwise." + (let ((st1 (stat file1)) + (st2 (stat file2))) + (and (eq? (stat:type st1) 'regular) + (eq? (stat:type st2) 'regular) + (= (stat:size st1) (stat:size st2)) (call-with-input-file file1 (lambda (port1) (call-with-input-file file2 @@ -117,7 +122,7 @@ single leaf." (n2 (get-bytevector-n! port2 buf2 0 len))) (and (equal? n1 n2) (or (eof-object? n1) - (loop))))))))))) + (loop)))))))))))) (define* (union-build output directories #:key (log-port (current-error-port)))