Bug 1529926 - using tab-completion for fedpkg crashes python3-argcomplete
Summary: using tab-completion for fedpkg crashes python3-argcomplete
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-argcomplete
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-31 08:26 UTC by Fabio Valentini
Modified: 2018-08-20 21:25 UTC (History)
14 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-08-20 21:25:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1608306 0 unspecified CLOSED Nonresponsive maintainer: dbmacartney 2021-02-22 00:41:40 UTC

Internal Links: 1608306

Description Fabio Valentini 2017-12-31 08:26:03 UTC
Description of problem:
Using tab completion in the shell for fedpkg commands crashes python3-argcomplete, and the crash collected by abrt (it refuses to process the crash though).


These are the details that abrt collects:

reason:
pkg_resources.DistributionNotFound: The 'fedpkg==1.30' distribution was not found and is required by the application

cmdline:
/usr/bin/python3 -s /usr/bin/python-argcomplete-check-easy-install-script /usr/bin/fedpkg

executable:
/usr/bin/python-argcomplete-check-easy-install-script

backtrace:
pkg_resources.DistributionNotFound: The 'fedpkg==1.30' distribution was not found and is required by the application

Traceback (most recent call last):
pkg_resources.DistributionNotFound: The 'fedpkg==1.30' distribution was not found and is required by the application

Local variables in innermost frame:
requirers: None
ws: <pkg_resources.WorkingSet object at 0x7f48dd771c18>
dist: None
req: Requirement.parse('fedpkg==1.30')
required_by: defaultdict(<class 'set'>, {})
req_extras: {}
to_activate: []
best: {'fedpkg': None}
processed: {}
extras: None
replace_conflicting: False
installer: None
env: <pkg_resources.Environment object at 0x7f48e110db38>
requirements: []
self: <pkg_resources.WorkingSet object at 0x7f48dd771c18>


Version-Release number of selected component (if applicable):
fedpkg-1.30-4.fc27.noarch
python3-argcomplete-1.9.2-1.fc27


How reproducible:
Every time the tab is pressed for completing fedpkg CLI.


Steps to Reproduce:
1. Install fedpkg and python3-argcomplete
2. In a shell, type "fedpkg new-so" and press the tab key


Actual results:
Exception happens in the argcomplete code, and after a small delay, tab completion happens.

Expected results:
Tab completion happens without delay and without causing exceptions.


Additional info:
Since fedpkg doesn't depend on python3-argcomplete, and I don't find any references to argcomplete in the fedpkg source code, I am not sure what causes this error.

Comment 1 cqi 2018-01-02 01:33:15 UTC
So far, there is no Python 3 package for fedpkg. It is only distributed in Python 2 package. I have no idea how python-argcomplete works, we also only provide bash and zsh autocomplete script.

Comment 2 Fabio Valentini 2018-01-02 06:10:05 UTC
I know, which is why I am baffled that installing a completely unrelated package suddenly produces these strange crashes when using fedpkg.
As I said, I couldn't find any code that could cause this issue - I just thought that someone else might be smarter than me and find something.

Comment 3 cqi 2018-01-02 07:52:23 UTC
Hi Fabio, what do you mean by "installing a completely unrelated package suddenly produces these strange crashes when using fedpkg."? Can you give the steps you did to reproduce this issue?

Comment 4 Fabio Valentini 2018-01-02 12:48:25 UTC
I mean this:

fedpkg is installed, python3-argcomplete is not:
everything works fine

fedpkg is installed, python3-argcomplete is also installed:
I get crashes during tab completion for fedpkg commands

Since fedpkg is a python2 package, python3-argcomplete obviously is a python3 package, and fedpkg isn't even using the argcomplete package, I consider those 2 completely unrelated packages, where installing one causes crashes when using the other - which is why I find this to be a strange error.

I don't even get error messages on the terminal when setting PYTHONWARNINGS, PYTHONDEBUG and PYTHONVERBOSE flags.


Upon further investigation, it looks like this is an error in the way argcomplete looks for completions (with the python-argcomplete-check-easy-install-script script): It always fall back to trying to import the package, and since fedpkg is a python2 application it fails because it wants to import a python3 package named fedpkg.

So, I'm reassigning this to the python-argcomplete package ... Thanks for your help.

Comment 5 Dominik 'Rathann' Mierzejewski 2018-01-06 09:34:49 UTC
Same here. Additionally, ABRT is unable to report it, saying the report data is invalid.

Comment 6 Miro Hrončok 2018-08-20 17:28:35 UTC
I cannot reproduce this in mock and on my system fedpkg is already python3 driven.

Can you still reproduce this?

Comment 7 Miro Hrončok 2018-08-20 17:38:34 UTC
The script has:

    if line1.startswith('#') and ('py' in line1 or 'Py' in line1):

We could patch it use:

    if line1.startswith('#') and ('/usr/bin/python3' in line1):

And that should do it.

Comment 8 Miro Hrončok 2018-08-20 18:24:54 UTC
Correction, fedpkg doesn't have PYTHON_ARGCOMPLETE_OK any more.

Comment 9 Fabio Valentini 2018-08-20 21:25:28 UTC
It looks like I can't reproduce this issue anymore with the latest fedpkg and python-argcomplete packages from fedora 28/updates-testing.

I think we can close this bug. I'll re-open it if it happens again. Thanks :)


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