grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposed PATCH to allow control of the kernel ordering in grub.cfg


From: Jeff Norden
Subject: Re: Proposed PATCH to allow control of the kernel ordering in grub.cfg
Date: Thu, 27 Dec 2018 08:23:12 -0600

Well, DRAT!

Nothing is ever as simple as it seems, is it?

1) Deleting the tr after the grep actually seems to break the patch.  My
apologies for not testing this more carefully in advance.  It looks like
the second tr masks grep's exit status, which is important b/c the
script runs with 'set -e' and exits immediately on any "error".  Seems
like changing |tr to ||true will work.

2) After reading Mihai Moldovan's comments above, I think it is better
to just use grep rather than egrep.  You could always add "-E" at the
beginning of the GRUB_PREFERRED_KERNEL string if you need to.  With GNU
grep, egrep and grep have the same functionality, and only differ in
when you need to backslash-escape some of the special characters.

3) Thinking about the second point, people might want to include other
grep flags in GRUB_PREFERRED_KERNEL, such as "-F", "-i", "-x", or even
"-P" (my personal favorite :-).  BUT, it then becomes clear that you
can't count 100% on grep to either return an empty string or entries
from $list.  If you accidentally include "-l" or "-c", then $linux might
be set to "(standard input)" or "1".  Potentially, this could put
10_linux into an infinite loop, but it would probably just crash quickly
due to "set -e" again.  In any case, this could leave someone's system
in an un-bootable state.  So, I think it will be necessary to check the
result of `grep "${GRUB_PREFERRED_KERNEL}"` more carefully.

Hopefully, I'll have some time to work on this next week.  I'll submit a
revised patch when I get it fixed.  I'm afraid it won't be quite as
simple as I originally thought, but it shouldn't be too much longer.

Happy New Year's to all!
-Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]