about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2022-11-19 18:08:40 +0100
committerGitHub <noreply@github.com>2022-11-19 18:08:40 +0100
commitc021df57927796175852f62c36b11e3b99a23f1d (patch)
tree894400be01aa9b57a8d2e2a32d80909b2a1e7bc1 /nixos/modules/system
parent647c745cc560583fa1240de34f45191c1eace0a8 (diff)
parentc2b3c9794dfb5a9ec4aa643fca07c1ac8ad3f644 (diff)
Merge pull request #197254 from Atemu/fstab-escape-options
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index 994aa0e33cbfa..4596c160a9571 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -342,6 +342,14 @@ checkFS() {
     return 0
 }
 
+escapeFstab() {
+    local original="$1"
+
+    # Replace space
+    local escaped="${original// /\\040}"
+    # Replace tab
+    echo "${escaped//$'\t'/\\011}"
+}
 
 # Function for mounting a file system.
 mountFS() {
@@ -569,7 +577,7 @@ while read -u 3 mountPoint; do
         continue
     fi
 
-    mountFS "$device" "$mountPoint" "$options" "$fsType"
+    mountFS "$device" "$(escapeFstab "$mountPoint")" "$(escapeFstab "$options")" "$fsType"
 done
 
 exec 3>&-