[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix savedefault after menu editing
From: |
Pavel Roskin |
Subject: |
[PATCH] Fix savedefault after menu editing |
Date: |
Tue, 02 May 2006 00:52:43 -0400 |
Hello!
This bug has annoyed me for years, so I decided to finally fix it. I
know, GRUB is GRUB Legacy now, but it there will be another release, it
should have this fix. Even if there will be no release, maybe this
patch will be applied by the OS vendors.
When using "e" to edit the commands followed by "b" to boot the edited
commands, the behavior of "savedefault" (if in was the command list)
seemed unpredictable. GRUB could suddenly select and boot a different
entry on the next boot.
As it turns out, "savedefault" was remembering the entry number in the
submenu used for editing the command. So, if e.g. the second command
was under the cursor, GRUB would default to the second entry on the next
boot. The fix is, of course, to calculate the current entry only in the
top level menu - either when booting or when calling a submenu.
2006-05-02 Pavel Roskin <address@hidden>
* stage2/stage2.c (run_menu): Fix "savedefault" to only save
positions in the top-level menu. Remember current position when
calling a submenu. Don't recalculate it when booting from a
submenu.
diff -u -r1.46 stage2.c
--- stage2/stage2.c 19 Mar 2005 18:02:52 -0000 1.46
+++ stage2/stage2.c 2 May 2006 04:10:33 -0000
@@ -651,7 +651,10 @@
*(new_heap++) = 0;
if (config_entries)
- run_menu (heap, NULL, new_num_entries, new_heap, 0);
+ {
+ current_entryno = first_entry + entryno;
+ run_menu (heap, NULL, new_num_entries, new_heap, 0);
+ }
else
{
cls ();
@@ -727,7 +730,8 @@
cur_entry = get_entry (config_entries, first_entry + entryno, 1);
/* Set CURRENT_ENTRYNO for the command "savedefault". */
- current_entryno = first_entry + entryno;
+ if (config_entries)
+ current_entryno = first_entry + entryno;
if (run_script (cur_entry, heap))
{
--
Regards,
Pavel Roskin
- [PATCH] Fix savedefault after menu editing,
Pavel Roskin <=
Re: [PATCH] Fix savedefault after menu editing, Yoshinori K. Okuji, 2006/05/02