> diff --git a/tools/bpf/bpftool/bash-completion/bpftool 
> b/tools/bpf/bpftool/bash-completion/bpftool
> index 75cbcb512ebae..1396083c4e67d 100644
> --- a/tools/bpf/bpftool/bash-completion/bpftool
> +++ b/tools/bpf/bpftool/bash-completion/bpftool

[ ... ]

> @@ -878,11 +883,11 @@ _bpftool()
>                          return 0
>                          ;;
>                      id)
> -                        _bpftool_get_map_ids_for_type perf_event_array
> +                        _bpftool_get_map_ids_for_types perf_event_array 
> ringbuf
>                          return 0
>                          ;;
>                      name)
> -                        _bpftool_get_map_names_for_type perf_event_array
> +                        _bpftool_get_map_names_for_types perf_event_array 
> ringbuf
>                          return 0
>                          ;;
>                      cpu)
>                          return 0
>                          ;;
>                      index)
>                          return 0
>                          ;;
>                      *)
>                          _bpftool_once_attr 'cpu index'
>                          return 0
>                          ;;

The event_pipe completion now offers ring buffer maps for the 'id' and
'name' cases, but the fallthrough '*' branch still suggests 'cpu index'
via _bpftool_once_attr. Can this cause tab-completion to offer
cpu/index keywords after a ring buffer map identifier?

Looking at do_event_pipe() in map_perf_ring.c:

    if (map_info.type == BPF_MAP_TYPE_RINGBUF && argc &&
        (is_prefix(*argv, "cpu") || is_prefix(*argv, "index"))) {
            p_err("ring buffer maps do not support cpu or index arguments");

the command explicitly rejects these selectors for ring buffers, and the
follow-up selftest (commit e12bcaa3a4d8e, subtests reject_cpu and
reject_index) verifies that error. The file already uses
_bpftool_map_guess_map_type() to make completion suggestions
type-dependent for other commands (lookup, update, push, enqueue), so
the mechanism to conditionally suppress cpu/index exists but appears not
to be applied here.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35440280049

Reply via email to