grub2 confusion

Michael Schwendt mschwendt at gmail.com
Thu Oct 6 23:01:29 UTC 2011


On Thu, 06 Oct 2011 16:32:33 -0600, EB (Eric) wrote:

> On 10/06/2011 03:04 PM, Michal Jaegermann wrote:
> > On Thu, Oct 06, 2011 at 10:09:44PM +0200, Michael Schwendt wrote:
> >>
> >> grub2-mkconfig is just a brute-force shell script that ends with
> >>
> >>     # none of the children aborted with error, install the new grub.cfg
> >>     mv -f ${grub_cfg}.new ${grub_cfg}
> >>
> >> so instead of not shipping an incompatible /etc/grub2.cfg symlink as
> >> long as this tool obviously cannot handle the symlink, there are lame and
> >> dubious attempts at defending the symlink.
> >
> > File a bug against grub2.  If instead of
> >
> >      mv -f ${grub_cfg}.new ${grub_cfg}
> >
> > you would have
> >
> >       cat ${grub_cfg}.new>  ${grub_cfg}; rm -f ${grub_cfg}.new
> >
> > you would not notice any troubles.
> 
> Umm, yes you would.  That's not atomic, and risks leaving things in an 
> inconsistent state.
> 
> http://www.flamingspork.com/talks/2007/06/eat_my_data.odp
> http://www.pixelbeat.org/docs/unix_file_replacement.html

cp -f ${grub_cfg}.new ${grub_cfg} ; rm -f ${grub_cfg}.new

Better? I assume you are not concerned about the removal of the temporary
local file in the second step, as that one would be removed everytime
grub2-mkconfig is run anyway. And it is made chmod 400, too.

-- 
Fedora release 16 (Verne) - Linux 3.1.0-0.rc8.git0.1.fc16.x86_64
loadavg: 0.00 0.01 0.05


More information about the test mailing list