From e76441b7186ebab16fa7214bad96b8999a94865e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 8 Jun 2021 13:25:01 -0700 Subject: don't try to cksum(1) directories Signed-off-by: Sean Whitton --- src/property.lisp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/property.lisp b/src/property.lisp index 332ef2c..1bba39e 100644 --- a/src/property.lisp +++ b/src/property.lisp @@ -571,11 +571,14 @@ PATH already has the specified CONTENT and MODE." ;; this is a safe parse of ls(1) output given its POSIX specification (defun ls-cksum (file) - (let ((ls (ignore-errors - (words (run :env '(:LC_ALL "C") "ls" "-dlL" file)))) - (cksum (ignore-errors (cksum file)))) - (when (and ls cksum) - (list* (car ls) cksum (subseq ls 2 8))))) + (when-let* ((ls (ignore-errors + (words (run :env '(:LC_ALL "C") "ls" "-dlL" file)))) + (ls-car (car ls)) + (ls-end (subseq ls 2 8))) + (if (char= #\d (elt ls-car 0)) + (cons ls-car ls-end) + (let ((cksum (ignore-errors (cksum file)))) + (and cksum (list* ls-car cksum ls-end)))))) (defmacro with-change-if-changes-file ((file) &body forms) "Execute FORMS and yield :NO-CHANGE if FILE does not change. -- cgit v1.2.3