diff mbox series

[bug#39698] file-systems: Set default value of the check? field to #f for NFS

Message ID 87d0a9i3il.fsf@gmail.com
State Accepted
Headers show
Series [bug#39698] file-systems: Set default value of the check? field to #f for NFS | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job

Commit Message

Maxim Cournoyer Feb. 20, 2020, 5:15 p.m. UTC
The attached patch makes the default value of the <file-system> record
check? filed smarter, and avoids boot failures when using an NFS system
and omitting to specify "check? #f".

There are no checkers for NFS and none are required.

Comments

Maxim Cournoyer Feb. 20, 2020, 8:29 p.m. UTC | #1
The patch sent earlier crashes 'guix system reconfigure config.scm'.  It
occurs when attempting to lower the object returned by the fold-services
procedure, e.g.:

--8<---------------cut here---------------start------------->8---
,m (guix scripts system)
scheme@(guix scripts system)> (define os (load* "/path/to/config.scm" %user-module))
scheme@(guix scripts system)> (lower-object os)
$2 = #<procedure 7fd849022e40 at guix/gexp.scm:231:5 (state)>
scheme@(guix scripts system)> ,import (guix monad-repl)
scheme@(guix scripts system)> ,run-in-store $2
While executing meta-command:
Throw to key `srfi-34' with args `(#<condition &gexp-input-error [input:
#<procedure 7fd84d36ac80 at ice-9/eval.scm:333:13 (a)>] 7fd84a760e00>)'.
--8<---------------cut here---------------end--------------->8---

I'm struggling to understand why.  To be continued.
Ludovic Courtès Feb. 22, 2020, 11:17 a.m. UTC | #2
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> --- a/gnu/system/file-systems.scm
> +++ b/gnu/system/file-systems.scm
> @@ -101,6 +101,8 @@
>  (define-record-type* <file-system> %file-system
>    make-file-system
>    file-system?
> +  this-file-system
> +
>    (device           file-system-device) ; string | <uuid> | <file-system-label>
>    (mount-point      file-system-mount-point)      ; string
>    (type             file-system-type)             ; string
> @@ -113,7 +115,10 @@
>    (needed-for-boot? %file-system-needed-for-boot? ; Boolean
>                      (default #f))
>    (check?           file-system-check?            ; Boolean
> -                    (default #t))
> +                    (thunked)
> +                    (default (not (string-prefix-ci?
> +                                   (file-system-type this-file-system)
> +                                   "nfs"))))

I’d rather avoid making ‘check?’ a thunked field (it adds a bit of
overhead and breaks ‘equal?’.)

Could we instead special-case NFS in (gnu build file-systems) such that
checking is a no-op?

Thanks,
Ludo’.
diff mbox series

Patch

From d6b5a47036b21ec4bf4109cd781ed76208713b71 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 20 Feb 2020 11:51:37 -0500
Subject: [PATCH] file-systems: Set default value of the check? field to #f for
 NFS.

Network file systems do not need to be checked locally, so provide a better
default value.

* gnu/system/file-systems.scm (<file-system>): Make the check? field thunked,
and compute the default value based on its own type.
---
 gnu/system/file-systems.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 7b78731524..03b143fcac 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -101,6 +101,8 @@ 
 (define-record-type* <file-system> %file-system
   make-file-system
   file-system?
+  this-file-system
+
   (device           file-system-device) ; string | <uuid> | <file-system-label>
   (mount-point      file-system-mount-point)      ; string
   (type             file-system-type)             ; string
@@ -113,7 +115,10 @@ 
   (needed-for-boot? %file-system-needed-for-boot? ; Boolean
                     (default #f))
   (check?           file-system-check?            ; Boolean
-                    (default #t))
+                    (thunked)
+                    (default (not (string-prefix-ci?
+                                   (file-system-type this-file-system)
+                                   "nfs"))))
   (create-mount-point? file-system-create-mount-point? ; Boolean
                        (default #f))
   (dependencies     file-system-dependencies      ; list of <file-system>
-- 
2.25.0