Hello community, here is the log from the commit of package grub2 for openSUSE:Factory checked in at 2016-08-18 10:19:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/grub2 (Old) and /work/SRC/openSUSE:Factory/.grub2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "grub2" Changes: -------- --- /work/SRC/openSUSE:Factory/grub2/grub2.changes 2016-08-11 18:53:07.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.grub2.new/grub2.changes 2016-08-18 10:19:56.000000000 +0200 @@ -1,0 +2,7 @@ +Fri Aug 12 08:32:05 UTC 2016 - mch...@suse.com + +- Workaround default entry in snapshot menu (bsc#956046) + * grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch +- grub2.spec: Add true command to grub.efi (bsc#993274) + +------------------------------------------------------------------- New: ---- grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ grub2.spec ++++++ --- /var/tmp/diff_new_pack.h5auFo/_old 2016-08-18 10:19:58.000000000 +0200 +++ /var/tmp/diff_new_pack.h5auFo/_new 2016-08-18 10:19:58.000000000 +0200 @@ -193,6 +193,7 @@ Patch105: grub2-btrfs-05-grub2-mkconfig.patch Patch106: grub2-btrfs-06-subvol-mount.patch Patch107: grub2-btrfs-07-subvol-fallback.patch +Patch108: grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch # Support EFI xen loader Patch120: grub2-efi-xen-chainload.patch Patch121: grub2-efi-chainloader-root.patch @@ -430,6 +431,7 @@ %patch105 -p1 %patch106 -p1 %patch107 -p1 +%patch108 -p1 %patch120 -p1 %patch121 -p1 %patch122 -p1 @@ -527,7 +529,7 @@ #TODO: add efifwsetup module FS_MODULES="ext2 btrfs ext2 xfs jfs reiserfs" -CD_MODULES=" all_video boot cat chain configfile echo \ +CD_MODULES=" all_video boot cat chain configfile echo true \ efinet font gfxmenu gfxterm gzio halt iso9660 \ jpeg minicmd normal part_apple part_msdos part_gpt \ password_pbkdf2 png reboot search search_fs_uuid \ ++++++ grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch ++++++ Index: grub-2.02~beta2/grub-core/normal/menu.c =================================================================== --- grub-2.02~beta2.orig/grub-core/normal/menu.c +++ grub-2.02~beta2/grub-core/normal/menu.c @@ -575,6 +575,44 @@ print_countdown (struct grub_term_coordi grub_refresh (); } +/* bsc#956046 - The first entry titled 'Bootable snapshot #$NUM' is inserted on + top at runtime to display current snapshot information. If default entry is + using number as key to index the entry, the result will be shifted so here we + add specical handling to shift it back. We apply this workaround until a better + solution can be found. */ +static void +workaround_snapshot_menu_default_entry (grub_menu_t menu, const char *name, int *default_entry) +{ + grub_menu_entry_t entry; + + if ((entry = grub_menu_get_entry (menu, 0)) + && entry->submenu + && grub_strncmp (entry->title, "Bootable snapshot", sizeof("Bootable snapshot") - 1) == 0) + { + const char *val; + + if (*default_entry == -1 && menu->size > 1) + { + *default_entry = 1; + return; + } + + val = grub_env_get (name); + + grub_error_push (); + + if (val) + grub_strtoul (val, 0, 0); + + if (*default_entry < (menu->size - 1) && grub_errno == GRUB_ERR_NONE) + ++(*default_entry); + + grub_error_pop (); + } + + return; +} + #define GRUB_MENU_PAGE_SIZE 10 /* Show the menu and handle menu entry selection. Returns the menu entry @@ -593,6 +631,8 @@ run_menu (grub_menu_t menu, int nested, default_entry = get_entry_number (menu, "default"); + workaround_snapshot_menu_default_entry (menu, "default", &default_entry); + /* If DEFAULT_ENTRY is not within the menu entries, fall back to the first entry. */ if (default_entry < 0 || default_entry >= menu->size)