From 8dd0c06fb64c8b516418cbdf8c385a6c817e7f26 Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Thu, 15 Jul 2021 09:44:30 +0300 Subject: [PATCH] (toberebased) home-services: Prevent unecessary system* call --- gnu/home-services.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gnu/home-services.scm b/gnu/home-services.scm index 78e5603edf..9afb70f0a7 100644 --- a/gnu/home-services.scm +++ b/gnu/home-services.scm @@ -341,8 +341,13 @@ with one gexp, but many times, and all gexps must be idempotent."))) "Check if FILE1 and FILE2 are bit for bit identical." (let* ((cmp-binary #$(file-append (@ (gnu packages base) diffutils) "/bin/cmp")) - (status (system* cmp-binary file1 file2))) - (= status 0))) + (stats1 (lstat file1)) + (stats2 (lstat file2))) + (cond + ((= (stat:ino stats1) (stat:ino stats2)) #t) + ((not (= (stat:size stats1) (stat:size stats2))) #f) + + (else (= (system* cmp-binary file1 file2) 0))))) (define (equal-symlinks? symlink1 symlink2) "Check if SYMLINK1 and SYMLINK2 are pointing to the same target." -- 2.32.0