Bug#239111: Grub is shockingly bad code

Steve McIntyre steve at einval.com
Sun Jan 4 02:25:28 UTC 2009


Thanks to Rob McQueen for doing a lot of research into this for his
mail about this bug on 12 Dec 2008. Based on that mail, I've looked
through the code in an attempt to find a way to implement a reasonable
fix: using FIBMAP as he suggested.

After several hours of working through the source, I give up. It's a
total mess and I'd much rather see grub simply removed from Debian
altogether than fix this bug and allow it to live on. Highlights:

 * gratuitous use of nested functions
 * horrific interfaces that don't pass enough information around
   internally, leading to:
 * functions passing internal state around via umarked global
   variables, relying on side effects
 * significantly obfuscated code
 * the core bug as described by Rob: accessing a block device
   underneath an active filesystem and assuming that the results will
   be safe and/or correct.

I *know* that grub is a bootloader, so it's always going to end up
having some nasty lowlevel code somewhere. But that's no excuse for
the code quality I've just seen. After this experience, I'm about to
remove grub from all my systems. Come back lilo, all is forgiven.

-- 
Steve McIntyre, Cambridge, UK.                                steve at einval.com
Is there anybody out there?






More information about the Pkg-grub-devel mailing list