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

Vladimir 'φ-coder/phcoder' Serbinenko phcoder at gmail.com
Tue Mar 16 09:20:47 UTC 2010


Josip Rodin wrote:
> 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.
>
>   
It does more than this. It checks that those files aren't on a
configuration inaccessible to grub. Colin Watson fixed slowness of these
tools but his patch didn't make it into 1.98


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 293 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20100316/ed69ddff/attachment.pgp>


More information about the Pkg-grub-devel mailing list