Bug#574088: grub-mkconfig GRUB_FONT_PATH determined by expensive is_path_readable_by_grub()

Josip Rodin joy at debbugs.entuzijast.net
Tue Mar 16 08:42:13 UTC 2010


Package: grub-pc
Version: 1.98~20100115-1

Hi,

It occurred to me that I should check why exactly is update-grub so
inexplicably slow these days. Here's one strange reason:

% time sudo sh -x /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
[...]
+ GRUB_TERMINAL_OUTPUT=gfxterm
+ [ -n  ]
+ path=/usr/share/grub/unicode.pf2
+ is_path_readable_by_grub /usr/share/grub/unicode.pf2
+ path=/usr/share/grub/unicode.pf2
+ test -e /usr/share/grub/unicode.pf2
+ :
+ /usr/sbin/grub-probe -t fs /usr/share/grub/unicode.pf2
^C
sudo sh -x /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg  0,13s user 0,14s system 24% cpu 1,081 total

By the time I noticed this and interrupted it for the sake of demonstration,
it had already spent a second - so it's clearly slow enough for the human
eye to notice :) The execution time of that exact command on my system is:

% time sudo /usr/sbin/grub-probe -t fs /usr/share/grub/unicode.pf2
ext2
sudo /usr/sbin/grub-probe -t fs /usr/share/grub/unicode.pf2  0,07s user 0,08s system 11% cpu 1,253 total
% time sudo /usr/sbin/grub-probe -t fs /usr/share/grub/unicode.pf2
ext2
sudo /usr/sbin/grub-probe -t fs /usr/share/grub/unicode.pf2  0,07s user 0,08s system 11% cpu 1,336 total
% time sudo /usr/sbin/grub-probe -t fs /usr/share/grub/unicode.pf2
ext2
sudo /usr/sbin/grub-probe -t fs /usr/share/grub/unicode.pf2  0,07s user 0,08s system 11% cpu 1,322 total

This is the default else case, where you check pkgdatadir, i.e. something
that is shipped with the package - so why do something that does nothing
else but verify basic sanity of the installation? A simple test -e should
suffice to account for e.g. a dpkg-divert...

I guess it's fine to use the expensive grub-probe-forking logic in the case
of a $GRUB_FONT - who knows where the user might have put it. Yet even then
it's still very much unlikely they put it out of reach, and after all the
analogous logic in /etc/grub.d/00_header should barf on them anyway :)

Please fix this. TIA.

-- 
     2. That which causes joy or happiness.





More information about the Pkg-grub-devel mailing list