On Sunday 22 March 2009 19:48:36 phcoder wrote:
Hello, I agree that non-sector aligned writes should be handled
correctly. However I disagree with removing of the magic number. I
personally would prefer if this file would have magic number and
checksum. AFAIK currently grub2 doesn't write to FS except in
load_env/save_env so a bug in code calling the hook could easily be
present. And I don't want grub2 to corrupt the filesystem because of any
such mistakes
For magic, alright. But I am not certain about the necessity of checksum.
Bean's code re-reads blocks so as to ensure that blocklists are identical to
what a given filesystem driver reads. So the probability of accidental writes
has been reduced very much already. It is hard for me to imagine the benefit
of adding more overhead. With this condition, if a checksum is invalid, the
cause must be either of these:
- that GRUB has a bug in a filesystem driver, so this has read wrong sectors
- that the content of grubenv has already been corrupted (e.g. because the
user modified it mistakenly)
In the latter case, there is no problem in GRUB overwriting the data, so we
don't have to care. In the former, this means that GRUB cannot read the
filesystem correctly anyway, so the user cannot boot any OS reliably. It is
rather surprising that the user has successfully installed GRUB.