open-power / petitboot

GNU General Public License v2.0
205 stars 56 forks source link

discover/grub2: Trim fields after BLS grub variable expansion #99

Closed rarbab closed 9 months ago

rarbab commented 1 year ago

Consider this line in a BLS config:

initrd /initramfs-5.14.0-70.13.1.el9_0.ppc64le.img $tuned_initrd

If $tuned_initrd is empty or unset, the initrd will be parsed as "/initramfs-5.14.0-70.13.1.el9_0.ppc64le.img ", with a trailing space. Since this file doesn't exist, trying to boot the entry will fail and report "Error loading initrd".

Add a test case for this. To fix, trim leading and trailing blank space from fields after the grub variables have been expanded.

rarbab commented 1 year ago

Thanks for reviewing! Yes, I'm okay with merging as-is.