about summary refs log tree commit diff
path: root/nixos/modules/tasks/filesystems
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2021-11-01 08:18:38 -0700
committertomberek <tomberek@users.noreply.github.com>2021-11-03 04:59:46 -0400
commit516b49155ed88965bf02a61c6a70fc255ce5409c (patch)
tree93eb53b5d00ca26731858fdfc5cf2a5ee68b5e97 /nixos/modules/tasks/filesystems
parent71e05e92875581803d39f0fb13bec8dc17559c69 (diff)
downloadnixlib-516b49155ed88965bf02a61c6a70fc255ce5409c.tar
nixlib-516b49155ed88965bf02a61c6a70fc255ce5409c.tar.gz
nixlib-516b49155ed88965bf02a61c6a70fc255ce5409c.tar.bz2
nixlib-516b49155ed88965bf02a61c6a70fc255ce5409c.tar.lz
nixlib-516b49155ed88965bf02a61c6a70fc255ce5409c.tar.xz
nixlib-516b49155ed88965bf02a61c6a70fc255ce5409c.tar.zst
nixlib-516b49155ed88965bf02a61c6a70fc255ce5409c.zip
nixos/zfs: replace parentheses with braces
The parentheses prevent the `continue` line from working by running the
enclosed in a subshell -- I noticed that ZFS would start asking me for
my password to encrypted child datasets, even though they were not
specified in `requestEncryptionCredentials`. The following logs would
also be present in the import unit's journal:

    Oct 31 22:13:17 host systemd[1]: Starting Import ZFS pool "pool"...
    Oct 31 22:13:44 host zfs-import-pool-start[3711]: importing ZFS pool "pool"...
    Oct 31 22:13:44 host zfs-import-pool-start[4017]:pool/nix/store/39zij3xcxn4w38v6x8f88bx8y91nv0rm-unit-script-zfs-import-pool-start/bin/zfs-import-pool-start: line 31: continue: only meaningful in a `for', `while', or `until' loop
    Oct 31 22:13:44 host zfs-import-pool-start[4020]:pool/nix/store/39zij3xcxn4w38v6x8f88bx8y91nv0rm-unit-script-zfs-import-pool-start/bin/zfs-import-pool-start: line 31: continue: only meaningful in a `for', `while', or `until' loop
    Oct 31 22:15:14 host zfs-import-pool-start[4023]: Failed to query password: Timer expired
    Oct 31 22:15:14 host zfs-import-pool-start[4024]: Key load error: encryption failure
    Oct 31 22:15:14 host systemd[1]: zfs-import-pool.service: Main process exited, code=exited, status=255/EXCEPTION
    Oct 31 22:15:14 host systemd[1]: zfs-import-pool.service: Failed with result 'exit-code'.
    Oct 31 22:15:14 host systemd[1]: Failed to start Import ZFS pool "pool".
Diffstat (limited to 'nixos/modules/tasks/filesystems')
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index 2c03ef7ba7e0..65364801c32a 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -561,7 +561,8 @@ in
                                   then cfgZfs.requestEncryptionCredentials
                                   else cfgZfs.requestEncryptionCredentials != []) ''
                   ${cfgZfs.package}/sbin/zfs list -rHo name,keylocation ${pool} | while IFS=$'\t' read ds kl; do
-                    (${optionalString (!isBool cfgZfs.requestEncryptionCredentials) ''
+                    {
+                      ${optionalString (!isBool cfgZfs.requestEncryptionCredentials) ''
                          if ! echo '${concatStringsSep "\n" cfgZfs.requestEncryptionCredentials}' | grep -qFx "$ds"; then
                            continue
                          fi
@@ -575,7 +576,8 @@ in
                       * )
                         ${cfgZfs.package}/sbin/zfs load-key "$ds"
                         ;;
-                    esac) < /dev/null # To protect while read ds kl in case anything reads stdin
+                    esac
+                    } < /dev/null # To protect while read ds kl in case anything reads stdin
                   done
                 ''}
                 echo "Successfully imported ${pool}"