summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--3138fa9e16edb1b0a3c07872815ce68b11c0e154.patch34
-rw-r--r--d9324c0c43e876d6f53b2d711dba375c119d22c5.patch27
-rw-r--r--dnf5.spec2
3 files changed, 63 insertions, 0 deletions
diff --git a/3138fa9e16edb1b0a3c07872815ce68b11c0e154.patch b/3138fa9e16edb1b0a3c07872815ce68b11c0e154.patch
new file mode 100644
index 0000000..ef8b3c7
--- /dev/null
+++ b/3138fa9e16edb1b0a3c07872815ce68b11c0e154.patch
@@ -0,0 +1,34 @@
+From 3138fa9e16edb1b0a3c07872815ce68b11c0e154 Mon Sep 17 00:00:00 2001
+From: Jaroslav Rohel <jrohel@redhat.com>
+Date: Tue, 9 Apr 2024 13:24:30 +0200
+Subject: [PATCH] dnf5: bash completion: Prefer using "_comp_initialize" with
+ fallback
+
+- ` _comp_initialize` was added in bash-completion 2.12
+- `_init_completion` is deprecated since bash-completion 2.12
+---
+ dnf5/bash-completion/dnf5 | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/dnf5/bash-completion/dnf5 b/dnf5/bash-completion/dnf5
+index 95419e5ab..de2745499 100644
+--- a/dnf5/bash-completion/dnf5
++++ b/dnf5/bash-completion/dnf5
+@@ -3,7 +3,16 @@
+ _do_dnf5_completion()
+ {
+ local cur prev words cword comp_args
+- _init_completion -n "><=;|&(:" -- "$@" || return
++
++ # Test if bash-completion supports "_comp_initialize" (added in bash-completion 2.12)
++ type _comp_initialize >/dev/null 2>&1
++ if [[ $? -eq 0 ]]; then
++ _comp_initialize -n "><=;|&(:" -- "$@" || return
++ else
++ # legacy function call (deprecated since bash-completion 2.12)
++ _init_completion -n "><=;|&(:" -- "$@" || return
++ fi
++
+ mapfile -t COMPREPLY <<<$("${1}" "--complete=${cword}" "${words[@]}")
+ }
+
diff --git a/d9324c0c43e876d6f53b2d711dba375c119d22c5.patch b/d9324c0c43e876d6f53b2d711dba375c119d22c5.patch
new file mode 100644
index 0000000..b2d2ebf
--- /dev/null
+++ b/d9324c0c43e876d6f53b2d711dba375c119d22c5.patch
@@ -0,0 +1,27 @@
+From d9324c0c43e876d6f53b2d711dba375c119d22c5 Mon Sep 17 00:00:00 2001
+From: Jaroslav Rohel <jrohel@redhat.com>
+Date: Tue, 9 Apr 2024 13:22:57 +0200
+Subject: [PATCH] dnf5: Bash completion: Switch to `_init_completion`
+
+- `_init_completion` handles redirections (example 2>/dev/null)
+ so completion doesn't have to deal with them.
+- `__reassemble_comp_words_by_ref` is private
+---
+ dnf5/bash-completion/dnf5 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/dnf5/bash-completion/dnf5 b/dnf5/bash-completion/dnf5
+index a860d3feb..95419e5ab 100644
+--- a/dnf5/bash-completion/dnf5
++++ b/dnf5/bash-completion/dnf5
+@@ -2,8 +2,8 @@
+
+ _do_dnf5_completion()
+ {
+- local words=() cword
+- __reassemble_comp_words_by_ref "><=;|&(:" words cword
++ local cur prev words cword comp_args
++ _init_completion -n "><=;|&(:" -- "$@" || return
+ mapfile -t COMPREPLY <<<$("${1}" "--complete=${cword}" "${words[@]}")
+ }
+
diff --git a/dnf5.spec b/dnf5.spec
index 76d0192..677125c 100644
--- a/dnf5.spec
+++ b/dnf5.spec
@@ -12,6 +12,8 @@ License: GPL-2.0-or-later
URL: https://github.com/rpm-software-management/dnf5
Source0: %{url}/archive/%{version}/dnf5-%{version}.tar.gz
Patch0: 0001-Fix-a-use-after-free-in-EmitterEmail-notify.patch
+Patch1: d9324c0c43e876d6f53b2d711dba375c119d22c5.patch
+Patch2: 3138fa9e16edb1b0a3c07872815ce68b11c0e154.patch
Requires: libdnf5%{?_isa} = %{version}-%{release}
Requires: libdnf5-cli%{?_isa} = %{version}-%{release}