Why are solely *some* (boolean and string) values quoted in Fedora's default GRUB2 configuration?

@glb, many thanks for those tests. That confirms it for booleans.

Additionally, stackoverflow.com/questions/72649342/are-integers-in-bash-signed-by-default/72649508#comment128332004_72649342 states that:

bash doesn’t really have “integers”. When you store a number in a variable, it’s a string (that happens to be a sequence of digits). When you do math in bash, it parses those strings into integers (of a platform-dependent type), does the math, then converts the result back to a string of digits for storage.

Summarily, integers appear to be strings too.

To my knowledge, /etc/default/grub is a POSIX-compliant shell script (albeit without the shebang) so that should mean that every value should be quoted.

This is probably an example of the file being lazily written by whoever decided these defaults for Fedora.

To demonstrate, the undermentioned functions identically to my aforementioned example:

GRUB_TIMEOUT="15" # Original: GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT="saved"
GRUB_DISABLE_SUBMENU="true"
GRUB_TERMINAL_OUTPUT="gfxterm" # Original: GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="" # Original: GRUB_CMDLINE_LINUX="rhgb quiet"
GRUB_DISABLE_RECOVERY="false" # Original: GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG="true"
GRUB_GFXMODE="2560x1440,auto"
GRUB_DISABLE_OS_PROBER="false"

2 Likes