grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] if timeout is set to zero, don't bother drawing the menu


From: Robert Millan
Subject: Re: [PATCH] if timeout is set to zero, don't bother drawing the menu
Date: Sun, 10 Feb 2008 13:55:33 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Sun, Feb 10, 2008 at 08:10:13AM +0100, Yoshinori K. Okuji wrote:
> On Saturday 09 February 2008 23:09, Robert Millan wrote:
> > On Sat, Feb 09, 2008 at 09:03:09PM +0100, Yoshinori K. Okuji wrote:
> > > On Friday 08 February 2008 17:18, Robert Millan wrote:
> > > > Fixes an ugly result of setting timeout=0.
> > > >
> > > > When this is combined with the "sleep" patch I just sent, user can
> > > > implement hiddenmenu-like functionality via scripting:
> > > >
> > > > echo -n "Press `ESC' to enter the menu... "
> > > > if sleep -v -i 10 ; then
> > > >   set timeout=10
> > > > else
> > > >   set timeout=0
> > > > fi
> > >
> > > I think this is a bit strange. I don't think anybody expects that "sleep"
> > > outputs a counter or is interrupted by a key input. It is too different
> > > from POSIX's sleep.
> > >
> > > My preference is rather to extend "read". Bash's "read" accepts a timeout
> > > and some other options.
> >
> > Ok, so you suggest:
> >
> >   read --timeout N --verbose --interruptible
> >
> >   ?
> 
> "read" exits when an input is passed by default, so "interruptible" sounds 
> odd. Here, I think what you want is a behavior that "read" does not wait for 
> ENTER, but reads immediately any character (or only ESC).

We could make the behaviour be, that if ESC is pressed at any time before an
input line is completed, the operation is aborted, read returns non-zero, and
it doesn't save the line to any variable.  What do you think?

> In GRUB Legacy, the hidden menu uses ESC, because if it uses ENTER, and the 
> user pushes ENTER too long, and a key repeat occurs, then the first item may 
> be selected quick as a flash. But we could avoid this problem by vacuuming 
> all inputs before showing a menu, so it might be acceptable to use ENTER 
> instead.

This is still error-prone.  Even if you vacuum the input buffer, we still have
a race between user unholding ENTER and GRUB showing the menu.  Vacuuming the
buffer just gives us more time, but doesn't garantee good results.

> (Actually, this should be implemented, regardless of this issue, because some 
> BIOSes may leave garbage in a key buffer. I don't remember if this has been 
> done for GRUB 2.)

You mean garbage is present when control is transfered to GRUB, or generated
afterwards?  I assume the first, but then if any user input is attempted
before removing the garbage, it may be corrupted.  So it should be done as
early as possible, shouldn't it?  Perhaps in grub_console_init()?

> To count down, I don't think it should be named "--verbose". For me, this is 
> like "--print-timeout".

Ok.

I had another patch for read already, for an unrelated extension.  If you
don't mind, I'll send that in first, since it's already implemented.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)




reply via email to

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