From 1b194afcc95b418330555a9b1de44f58aa79b505 Mon Sep 17 00:00:00 2001 From: Diederik de Haas Date: Tue, 15 Nov 2022 14:37:08 +0100 Subject: [PATCH] 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. --- .../initramfs-tools/scripts/local-bottom/rpi-resizerootfs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs b/rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs index 680e133..64b4dee 100755 --- a/rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs +++ b/rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs @@ -46,7 +46,10 @@ partprobe "$rootdev" resize2fs "$rootpart" # 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." fi