Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-100071

Bash completion does not work for alterante pips (3.11)

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • rhel-9.7
    • CentOS Stream 8, CentOS Stream 9
    • python3.11-pip
    • None
    • python3.11-pip-22.3.1-6.el9
    • No
    • Low
    • 1
    • rhel-pt-python
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • PT Python 2025 S09
    • Unspecified Release Note Type - Unknown
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      During the work on https://src.fedoraproject.org/rpms/python-pip/pull-request/156 I have noticed we have the following code in python3.X-pip.spec

      python3.11-pip.spec:

      # Make bash completion apply to all the 5 symlinks we install
      sed -i -e "s/^\\(complete.*\\) pip\$/\\1 pip{,-}%{python3_pkgversion}/" \
          -e s/_pip_completion/_pip%{python3_pkgversion}_completion/ \
          %{buildroot}%{bashcompdir}/pip%{python3_pkgversion}
      

      python3.12-pip.spec:

      # Make bash completion apply to all the 5 symlinks we install
      sed -i -e "s/^\\(complete.*\\) pip\$/\\1 pip{,-}%{python3_pkgversion}}/" \
          -e s/_pip_completion/_pip%{python3_pkgversion}_completion/ \
          %{buildroot}%{bashcompdir}/pip%{python3_pkgversion}
      

      This leads to the following bash completion files:

      _pip3.11_completion()
      {
          ...
      }
      complete -o default -F _pip3.11_completion pip{,-}3.11
      
      
      _pip3.12_completion()
      {
          ...
      }
      complete -o default -F _pip3.12_completion pip{,-}3.12}
      
      

      There are two problems:

      • on Python 3.12, there is a superfluous } so this does not work at all
      • on both Pythons, the function name has a dot in it (the code was likely copied from python39 where there was no dot in % {python3_pkgversion}

      As a result, Bash completion for pip3.11 and pip3.12 is broken on RHEL 8 and 9.

              rhn-support-lzachar Lukas Zachar
              mhroncok@redhat.com Miro HronĨok
              python-maint python-maint
              rhel-python-qe bot rhel-python-qe bot
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: