stage-1: escape mount points and options

mountFS adds these strings to fstab and then relies on `mount` parsing fstab. If
they have spaces or tabs in them, that would break fstab and therefore not mount
with the unhelpful error: No such file or directory.

Co-authored-by: Lily Foster <lily@lily.flowers>

Co-authored-by: Luflosi <Luflosi@users.noreply.github.com>

Atemu 753f883c 7e2aec07

Changed files
+9 -1
nixos
modules
system
+9 -1
nixos/modules/system/boot/stage-1-init.sh
···
return 0
}
# Function for mounting a file system.
mountFS() {
···
continue
fi
-
mountFS "$device" "$mountPoint" "$options" "$fsType"
done
exec 3>&-
···
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() {
···
continue
fi
+
mountFS "$device" "$(escapeFstab "$mountPoint")" "$(escapeFstab "$options")" "$fsType"
done
exec 3>&-