From 4c0e72a7043c949b4be6b679f059b8386f7135b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= Date: Mon, 16 Feb 2026 11:01:02 +0100 Subject: [PATCH] Use stable _init_completion API in bash completion Replace private bash-completion functions (`_comp__split_longopt`, `_get_cword`) with the stable public `_init_completion` API. The private functions were renamed in bash-completion 2.12, breaking tab completion on systems with either the old or new version. `_init_completion` has been stable since bash-completion 2.0 and works across all versions. Resolves: https://issues.redhat.com/browse/RHEL-145121 --- dist/bash_completion.d/oscap | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/dist/bash_completion.d/oscap b/dist/bash_completion.d/oscap index 1b237ffdce..63bc4bf305 100644 --- a/dist/bash_completion.d/oscap +++ b/dist/bash_completion.d/oscap @@ -42,16 +42,15 @@ function _oscap { opts[oscap:info]="--fetch-remote-resources --local-files --profile --profiles --references" # local variables - local std cmd i prev - local c=1 - local cur="`_get_cword`" - local prog="${COMP_WORDS[0]}" + local cur prev words cword split + _init_completion -s || return + local cmd i + local c=1 local modpath='oscap' - _comp__split_longopt || prev="${COMP_WORDS[$COMP_CWORD-1]}" # get module path - while [ $c -lt $COMP_CWORD ]; do - i="${COMP_WORDS[c]}" + while [ $c -lt $cword ]; do + i="${words[c]}" case "$i" in # TODO handle generic switches -*) _oscap_noarg "$i"; c=$((c + $?)) ;; @@ -70,7 +69,12 @@ function _oscap { --report) _filedir 'html' ;; esac - elif [ "x${cur:0:1}" == "x-" ]; then + return + fi + + $split && return + + if [ "x${cur:0:1}" == "x-" ]; then # an option COMPREPLY=( $(compgen -W "${opts[$modpath]}" -- ${cur}) ) elif [ "x${cmds[$modpath]}" != 'x' ]; then