[Bug 439784] Re: invalid: environment block

Colin Watson cjwatson at canonical.com
Tue Oct 13 19:42:06 UTC 2009


On Tue, Oct 13, 2009 at 06:59:11PM -0000, Jordan wrote:
> However, it looks like grub-editenv is still not atomic: If you run
> "grub-editenv /boot/grub/grubenv set foo=bar" the first thing it does in
> create_env_blk_file() is call fopen( "/boot/grub/grubenv", "wb" )
> truncating the actual file, not a temporary version. So if grub-editenv
> crashes between the fopen() and the fwrite() ( admittedly only two real
> lines of code ) or somehow fopen() succeeds but fwrite() fails, you will
> be left with a zero byte file.

I indeed noticed the same thing a couple of weeks ago, and fixed it
upstream for GRUB 1.97~beta4. :-)

2009-10-01  Colin Watson  <cjwatson at ubuntu.com>

        * util/grub-editenv.c (create_envblk_file): Write new block with a
        .new suffix and then rename it into place, to ensure atomic
        creation.

-- 
invalid: environment block
https://bugs.launchpad.net/bugs/439784
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list