diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-08 13:25:01 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-08 13:25:01 -0700 |
commit | e76441b7186ebab16fa7214bad96b8999a94865e (patch) | |
tree | 1b069c00dcaecbd21c29deb92dde70d875c9353e | |
parent | 14b86639825699489ac1c18700da12f593f41188 (diff) | |
download | consfigurator-e76441b7186ebab16fa7214bad96b8999a94865e.tar.gz |
don't try to cksum(1) directories
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | src/property.lisp | 13 |
1 files 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. |