Bug 2211862 - python-argcomplete doesn't work when installed in completionsdir
Summary: python-argcomplete doesn't work when installed in completionsdir
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-argcomplete
Version: 38
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-02 10:55 UTC by Viktor Ashirov
Modified: 2023-06-08 02:02 UTC (History)
7 users (show)

Fixed In Version: python-argcomplete-2.0.0-8.fc39 python-argcomplete-2.0.0-8.fc38
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-06-08 02:02:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Viktor Ashirov 2023-06-02 10:55:22 UTC
In F38 installation of python-argcomplete script that is used for global completion activation was changed from compatdir (/etc/bash_completion.d) to completionsdir (/usr/share/bash-completion/completions):
https://src.fedoraproject.org/rpms/python-argcomplete/c/8c493c15eb35a2b798024771cde25ec73e818a72?branch=rawhide

Unfortunately, this breaks autocompletion for programs that rely on python-argcomplete being loaded. Completions from compatdir are loaded eagerly, unlike completionsdir. 

According to author of python-argcomplete:
> The pre-dynamic loading bash-completion directory is used because unfortunately, there is no way to hook a complete -D script into the bash-completion 2.0 infrastructure, and that is required for global completion activation. 

https://github.com/kislyuk/argcomplete/issues/426#issuecomment-1547135817

Please revert script installation to compatdir (/etc/bash_completion.d).



Reproducible: Always

Steps to Reproduce:
1. Use the following script:
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
import argcomplete, argparse

parser = argparse.ArgumentParser()
argcomplete.autocomplete(parser)
args = parser.parse_args()

2. chmod +x test.py
3. ./test.py<TAB><TAB>

Actual Results:  
Completion doesn't work

Expected Results:  
$ ./test.py -<TAB>
-h      --help

Version: python3-argcomplete-2.0.0-6.fc38.noarch

Comment 1 Miro Hrončok 2023-06-05 14:58:28 UTC
I've opened https://src.fedoraproject.org/rpms/python-argcomplete/pull-request/14 and https://src.fedoraproject.org/rpms/python-argcomplete/pull-request/15

I was unable to make see it working in a container, will try mock and if that fails, a real VM.

Comment 2 Miro Hrončok 2023-06-05 15:09:58 UTC
OK, it worked in a VM.

Comment 3 Todd Zullinger 2023-06-05 15:22:42 UTC
Thanks Miro.  I made essentially the same changes (I should read my bugzilla mail in full before doing anything :).

Comment 4 Fedora Update System 2023-06-05 20:56:38 UTC
FEDORA-2023-e1abb2006a has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-e1abb2006a

Comment 5 Fedora Update System 2023-06-05 22:10:12 UTC
FEDORA-2023-e1abb2006a has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2023-06-06 09:25:58 UTC
FEDORA-2023-94df1a4de4 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-94df1a4de4

Comment 7 Fedora Update System 2023-06-07 01:38:37 UTC
FEDORA-2023-94df1a4de4 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-94df1a4de4`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-94df1a4de4

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2023-06-08 02:02:56 UTC
FEDORA-2023-94df1a4de4 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.