scripts: Show disk-space warning when under the min of the thresholds.
authorPierre Neidhardt <mail@ambrevar.xyz>
Fri, 6 Mar 2020 07:29:09 +0000 (08:29 +0100)
committerPierre Neidhardt <mail@ambrevar.xyz>
Fri, 6 Mar 2020 07:32:01 +0000 (08:32 +0100)
Follow-up to 71c3c3df92375ca9b4bd28b2be90dda67288fa5c which got the logic
wrong.

* guix/scripts.scm (warn-about-disk-space): Compare AVAILABLE to the min of
RELATIVE-THRESHOLD-IN-BYTES and ABSOLUTE-THRESHOLD-IN-BYTES, not the max.

guix/scripts.scm

index e235c8d..3e19e38 100644 (file)
@@ -237,7 +237,7 @@ THRESHOLDS is a pair (ABSOLUTE-THRESHOLD . RELATIVE-THRESHOLD)."
          (total      (* block-size (file-system-block-count stats)))
          (relative-threshold-in-bytes (* total (cadr thresholds)))
          (absolute-threshold-in-bytes (car thresholds)))
-    (when (< available (max relative-threshold-in-bytes
+    (when (< available (min relative-threshold-in-bytes
                             absolute-threshold-in-bytes))
       (warning (G_ "only ~,1f GiB of free space available on ~a~%")
                (/ available 1. GiB) (%store-prefix))