All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Norden <jeff@math.tntech.edu>
To: grub-devel@gnu.org
Subject: Re: Proposed PATCH to allow control of the kernel ordering in grub.cfg
Date: Thu, 27 Dec 2018 08:23:12 -0600	[thread overview]
Message-ID: <fdftujt5f3.fsf@norden.math.tntech.edu> (raw)
In-Reply-To: <fdva3nbu8j.fsf@norden.math.tntech.edu> (message from Jeff Norden on Thu, 20 Dec 2018 18:26:20 -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	other threads:[~2018-12-27 14:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-19  6:50 Proposed PATCH to allow control of the kernel ordering in grub.cfg Jeff Norden
2018-12-20 11:53 ` Daniel Kiper
2018-12-21  5:20   ` Mihai Moldovan
2018-12-21  0:26 ` Jeff Norden
2018-12-27 14:23   ` Jeff Norden [this message]
2018-12-31  8:09     ` Mihai Moldovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fdftujt5f3.fsf@norden.math.tntech.edu \
    --to=jeff@math.tntech.edu \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.