From c66ed2686f4948e2f8cf7e6d226778f4e305fa1dbac3227eccd7a54d87bbcabc Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Mon, 15 Apr 2024 05:33:14 +0000 Subject: [PATCH] Accepting request 1166747 from home:gary_lin:branches:Base:System - Fix the compatibility issue with bash-completion 2.12 (bsc#1221849) * 0001-util-bash-completion-Fix-for-bash-completion-2.12.patch OBS-URL: https://build.opensuse.org/request/show/1166747 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=499 --- ...pletion-Fix-for-bash-completion-2.12.patch | 188 ++++++++++++++++++ grub2.changes | 7 + grub2.spec | 1 + 3 files changed, 196 insertions(+) create mode 100644 0001-util-bash-completion-Fix-for-bash-completion-2.12.patch diff --git a/0001-util-bash-completion-Fix-for-bash-completion-2.12.patch b/0001-util-bash-completion-Fix-for-bash-completion-2.12.patch new file mode 100644 index 0000000..cde1a89 --- /dev/null +++ b/0001-util-bash-completion-Fix-for-bash-completion-2.12.patch @@ -0,0 +1,188 @@ +From 200dc727d1fdf3bac7aa725569b60a54b3841867 Mon Sep 17 00:00:00 2001 +From: Gary Lin +Date: Fri, 22 Mar 2024 16:23:38 +0800 +Subject: [PATCH] util/bash-completion: Fix for bash-completion 2.12 + +_split_longopt() was the bash-completion private API and removed since +bash-completion 2.12. This commit initializes the bash-completion +general variables with _init_completion() to avoid the potential +'command not found' error. + +Although bash-completion 2.12 introduces _comp_initialize() to deprecate +_init_completion(), _init_completion() is still chosen for the better +backward compatibility. + +Signed-off-by: Gary Lin +--- + .../bash-completion.d/grub-completion.bash.in | 61 +++++++------------ + 1 file changed, 22 insertions(+), 39 deletions(-) + +diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in +index 4c88ee901..749a5d3cf 100644 +--- a/util/bash-completion.d/grub-completion.bash.in ++++ b/util/bash-completion.d/grub-completion.bash.in +@@ -151,13 +151,10 @@ __grub_list_modules () { + # grub-set-default & grub-reboot + # + __grub_set_entry () { +- local cur prev split=false ++ local cur prev words cword split ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} +- +- _split_longopt && split=true + + case "$prev" in + --boot-directory) +@@ -180,11 +177,10 @@ __grub_set_entry () { + # grub-editenv + # + __grub_editenv () { +- local cur prev ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + create|list|set|unset) +@@ -201,10 +197,10 @@ __grub_editenv () { + # grub-mkconfig + # + __grub_mkconfig () { +- local cur prev ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + __grubcomp "$(__grub_get_options_from_help)" +@@ -217,13 +213,10 @@ __grub_mkconfig () { + # grub-setup + # + __grub_setup () { +- local cur prev split=false ++ local cur prev words cword split ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} +- +- _split_longopt && split=true + + case "$prev" in + -d|--directory) +@@ -246,15 +239,12 @@ __grub_setup () { + # grub-install + # + __grub_install () { +- local cur prev last split=false ++ local cur prev words cword split last ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} + last=$(__grub_get_last_option) + +- _split_longopt && split=true +- + case "$prev" in + --boot-directory) + _filedir -d +@@ -287,10 +277,10 @@ __grub_install () { + # grub-mkfont + # + __grub_mkfont () { +- local cur ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + __grubcomp "$(__grub_get_options_from_help)" +@@ -304,11 +294,10 @@ __grub_mkfont () { + # grub-mkrescue + # + __grub_mkrescue () { +- local cur prev last ++ local cur prev words cword last ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} + last=$(__grub_get_last_option) + + if [[ "$cur" == -* ]]; then +@@ -330,13 +319,10 @@ __grub_mkrescue () { + # grub-mkimage + # + __grub_mkimage () { +- local cur prev split=false ++ local cur prev words cword split ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} +- +- _split_longopt && split=true + + case "$prev" in + -d|--directory|-p|--prefix) +@@ -367,10 +353,10 @@ __grub_mkimage () { + # grub-mkpasswd-pbkdf2 + # + __grub_mkpasswd_pbkdf2 () { +- local cur ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + __grubcomp "$(__grub_get_options_from_help)" +@@ -384,13 +370,10 @@ __grub_mkpasswd_pbkdf2 () { + # grub-probe + # + __grub_probe () { +- local cur prev split=false ++ local cur prev words cword split ++ _init_completion -s || return + + COMPREPLY=() +- cur=`_get_cword` +- prev=${COMP_WORDS[COMP_CWORD-1]} +- +- _split_longopt && split=true + + case "$prev" in + -t|--target) +@@ -417,10 +400,10 @@ __grub_probe () { + # grub-script-check + # + __grub_script_check () { +- local cur ++ local cur prev words cword ++ _init_completion || return + + COMPREPLY=() +- cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + __grubcomp "$(__grub_get_options_from_help)" +-- +2.35.3 + diff --git a/grub2.changes b/grub2.changes index ba46b9e..0e4c3a8 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Apr 11 02:55:05 UTC 2024 - Gary Ching-Pang Lin + +- Fix the compatibility issue with bash-completion 2.12 + (bsc#1221849) + * 0001-util-bash-completion-Fix-for-bash-completion-2.12.patch + ------------------------------------------------------------------- Fri Mar 29 01:58:00 UTC 2024 - Michael Chang diff --git a/grub2.spec b/grub2.spec index 31cea18..2bb5f9d 100644 --- a/grub2.spec +++ b/grub2.spec @@ -405,6 +405,7 @@ Patch211: 0009-10_linux-Some-refinement-for-BLS.patch Patch212: grub2-bsc1220338-key_protector-implement-the-blocklist.patch Patch213: 0001-ofdisk-Enhance-canonical-path-handling-for-bootpath.patch Patch214: 0001-10_linux-Ensure-persistence-of-root-file-system-moun.patch +Patch215: 0001-util-bash-completion-Fix-for-bash-completion-2.12.patch Requires: gettext-runtime %if 0%{?suse_version} >= 1140