Fix bug introduced when 'fixing' SC2086 (quotes)

The 'ROOTFLAGS' parameter should NOT be quoted as it then introduces an
(empty) extra argument to 'mount', causing a boot failure.
Thanks to 'mjt' for the help and identifying the issue.

Lessons learned:
1) Don't blindly follow the *suggestions* that shellcheck makes
2) Test your changes (properly) before submitting/merging them

ad 1) I find shellcheck a very useful tool, but it doesn't (and likely
can't) understand the full context. The developer does (or should) and
should evaluate each suggestion whether it's applicable in this case.

ad 2) This should've been obvious and certainly for me.
I'm normally very dilligent and test all my changes, but I got sloppy
this time and did not. With logical consequences.
This commit is contained in:
Diederik de Haas 2022-11-15 14:37:08 +01:00
parent 422832740b
commit 1b194afcc9
No known key found for this signature in database
GPG Key ID: D76E5BCE787EDB6E
1 changed files with 4 additions and 1 deletions

View File

@ -46,7 +46,10 @@ partprobe "$rootdev"
resize2fs "$rootpart" resize2fs "$rootpart"
# Remount root # Remount root
if ! mount -r ${FSTYPE:+-t "${FSTYPE}"} "${ROOTFLAGS}" "${ROOT}" "${rootmnt?}"; then # Don't quote ${ROOTFLAGS} as that results in an extra (empty) argument
# to 'mount', which in turn causes a boot failure
# shellcheck disable=SC2086
if ! mount -r ${FSTYPE:+-t "${FSTYPE}"} ${ROOTFLAGS} "${ROOT}" "${rootmnt?}"; then
panic "Failed to mount ${ROOT} as root file system." panic "Failed to mount ${ROOT} as root file system."
fi fi