bug-grub
[Top][All Lists]
Advanced

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

Re: GRUB patch for 'lilo -R' functionality


From: Keir Fraser
Subject: Re: GRUB patch for 'lilo -R' functionality
Date: Wed, 12 Nov 2003 11:27:29 +0000

> >  2. Any specified timeout will be ignored on next boot (i.e. the menu
> >     won't even be displayed).
> 
> That happens with later revisions of your patch, where you added that
> feature. However, as previously discussed, it's preferrable not to do this.

Depends how closely you wnat to mimic 'lilo -R'. If you specify a
one-shot boot into a particular menu option, I take it to mean that
you're making your menu selection for next boot at that point in time
(i.e., Why display the menu? By running savedefault with --once option
the user has already expressed their desire for this boot.).

> >  3. After next boot, the above behaviour will be disabled until next
> >     use of savedefault --once from GRUB shell.
> 
> But that doesn't work with your patch. Presumably, _SAVED_ENTRYNO is not
> reset to 0, either because _ONCEONLY_ENTRY is not set in the GRUB shell, or
> because it is not honored by GRUB when booting.
> 
> Could you have a look at that?

Yeah.

Have you been running 'savedefault --once --default=X' or
'savedefault --default=X --once' ??

If the former then it's because the patch is a bit broken since option
order matters. This is easily fixed!

This code:
-------------------
  int new_default = 0;

  while (1)
    {
      if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0)
        {
          stage2_os_file = arg + sizeof ("--stage2=") - 1;
          arg = skip_to (0, arg);
          nul_terminate (stage2_os_file);
        }
      else if (grub_memcmp ("--default=", arg, sizeof ("--default=") - 1) == 0)
        {
          char *p = arg + sizeof ("--default=") - 1;
          if (! safe_parse_maxint (&p, &new_default))
            return 1;
          arg = skip_to (0, arg);
        }
      else if (grub_memcmp ("--once", arg, sizeof ("--once") - 1) == 0)
        {
          new_default |= STAGE2_ONCEONLY_ENTRY;
          arg = skip_to (0, arg);
        }
      else
        break;
    }
-------------------

should actually be:
-------------------
  int new_default = 0, once_only = 0;

  while (1)
    {
      if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0)
        {
          stage2_os_file = arg + sizeof ("--stage2=") - 1;
          arg = skip_to (0, arg);
          nul_terminate (stage2_os_file);
        }
      else if (grub_memcmp ("--default=", arg, sizeof ("--default=") - 1) == 0)
        {
          char *p = arg + sizeof ("--default=") - 1;
          if (! safe_parse_maxint (&p, &new_default))
            return 1;
          arg = skip_to (0, arg);
        }
      else if (grub_memcmp ("--once", arg, sizeof ("--once") - 1) == 0)
        {
          once_only = 1;
          arg = skip_to (0, arg);
        }
      else
        break;
    }

    if (once_only)
      new_default |= STAGE2_ONCEONLY_ENTRY;
--------------------

 -- Keir




reply via email to

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