Bug 2231593 - [abrt] python3-argcomplete: __getitem__(): __init__.py:287:__getitem__:KeyError: 'console_scripts'
Summary: [abrt] python3-argcomplete: __getitem__(): __init__.py:287:__getitem__:KeyErr...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-argcomplete
Version: 39
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL: https://retrace.fedoraproject.org/faf...
Whiteboard: abrt_hash:3691f92589ce3b3ab9c1feb2839...
: 2231589 (view as bug list)
Depends On:
Blocks: PYTHON3.12 F39BetaFreezeException
TreeView+ depends on / blocked
 
Reported: 2023-08-12 08:33 UTC by Mamoru TASAKA
Modified: 2023-09-21 00:16 UTC (History)
10 users (show)

Fixed In Version: python-argcomplete-2.0.0-11.fc40 python-argcomplete-2.0.0-11.fc39 python-argcomplete-2.0.0-12.fc40 python-argcomplete-2.0.0-12.fc39
Clone Of:
Environment:
Last Closed: 2023-09-21 00:16:09 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: environ (3.27 KB, text/plain)
2023-08-12 08:33 UTC, Mamoru TASAKA
no flags Details
File: mountinfo (3.34 KB, text/plain)
2023-08-12 08:34 UTC, Mamoru TASAKA
no flags Details
File: open_fds (418 bytes, text/plain)
2023-08-12 08:34 UTC, Mamoru TASAKA
no flags Details
File: namespaces (171 bytes, text/plain)
2023-08-12 08:34 UTC, Mamoru TASAKA
no flags Details
File: backtrace (22.22 KB, text/plain)
2023-08-12 08:34 UTC, Mamoru TASAKA
no flags Details
File: os_info (687 bytes, text/plain)
2023-08-12 08:34 UTC, Mamoru TASAKA
no flags Details
File: cpuinfo (2.43 KB, text/plain)
2023-08-12 08:34 UTC, Mamoru TASAKA
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github kislyuk argcomplete pull 448 0 None open Ensure Python 3.12+ compatibility in check_console_script 2023-09-14 12:29:30 UTC

Description Mamoru TASAKA 2023-08-12 08:33:55 UTC
Description of problem:
1. launch a new terminal (such as gnome-terminal)
2. On new terminal, type $ koji <tab><tab>

Then this backtrace occurrs (100% reproducible)

koji-1.33.1-2.fc39.noarch
python3-argcomplete-2.0.0-10.fc39.noarch

Version-Release number of selected component:
python3-argcomplete-2.0.0-10.fc39

Additional info:
reporter:       libreport-2.17.11
runlevel:       N 5
interpreter:    python3-3.12.0~rc1-1.fc39.x86_64
reason:         __init__.py:287:__getitem__:KeyError: 'console_scripts'
exception_type: StopIteration
crash_function: __getitem__
cmdline:        /usr/bin/python3 -m argcomplete._check_console_script /bin/koji
type:           Python3
kernel:         6.4.9-200.fc38.x86_64
cgroup:         0::/user.slice/user-500.slice/user/app.slice/app-org.gnome.Terminal.slice/vte-spawn-df5ed674-d1c2-4411-876d-8022134f2db2.scope
uid:            500
executable:     /usr/lib/python3.12/site-packages/argcomplete/_check_console_script.py
package:        python3-argcomplete-2.0.0-10.fc39

Truncated backtrace:
#1 [/usr/lib64/python3.12/importlib/metadata/__init__.py:285] __getitem__


Potential duplicate: bug 2231589

Comment 1 Mamoru TASAKA 2023-08-12 08:33:59 UTC
Created attachment 1983100 [details]
File: environ

Comment 2 Mamoru TASAKA 2023-08-12 08:34:01 UTC
Created attachment 1983101 [details]
File: mountinfo

Comment 3 Mamoru TASAKA 2023-08-12 08:34:02 UTC
Created attachment 1983102 [details]
File: open_fds

Comment 4 Mamoru TASAKA 2023-08-12 08:34:04 UTC
Created attachment 1983103 [details]
File: namespaces

Comment 5 Mamoru TASAKA 2023-08-12 08:34:06 UTC
Created attachment 1983104 [details]
File: backtrace

Comment 6 Mamoru TASAKA 2023-08-12 08:34:07 UTC
Created attachment 1983105 [details]
File: os_info

Comment 7 Mamoru TASAKA 2023-08-12 08:34:08 UTC
Created attachment 1983106 [details]
File: cpuinfo

Comment 9 Miro Hrončok 2023-08-13 17:58:11 UTC
*** Bug 2231589 has been marked as a duplicate of this bug. ***

Comment 11 Fedora Update System 2023-08-14 04:13:50 UTC
FEDORA-2023-530e9e4567 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-530e9e4567

Comment 12 Fedora Update System 2023-08-14 04:14:35 UTC
FEDORA-2023-237c202647 has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-237c202647

Comment 13 Fedora Update System 2023-08-14 05:24:37 UTC
FEDORA-2023-237c202647 has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2023-08-14 05:45:36 UTC
FEDORA-2023-530e9e4567 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 15 Lukas Ruzicka 2023-08-30 08:32:04 UTC
I wanted to have the path argument autocompleted and pressed tab when this occured.


reporter:       libreport-2.17.11
kernel:         6.5.0-57.fc39.x86_64
cmdline:        /usr/bin/python3 -m argcomplete._check_console_script /home/lruzicka/.local/bin/needly
cgroup:         0::/user.slice/user-1000.slice/user/app.slice/vte-spawn-f39e3819-9344-44c0-acc9-d3a1f3b0510a.scope
uid:            1000
reason:         __init__.py:287:__getitem__:KeyError: 'console_scripts'
executable:     /usr/lib/python3.12/site-packages/argcomplete/_check_console_script.py
type:           Python3
package:        python3-argcomplete-2.0.0-11.fc39
runlevel:       N 5
exception_type: StopIteration
crash_function: __getitem__
interpreter:    python3-3.12.0~rc1-1.fc39.x86_64
comment:        I wanted to have the path argument autocompleted and pressed tab when this occured.

Comment 16 leigh scott 2023-09-06 16:24:29 UTC
Occurs when I use fedpkg or rfpkg command.


reporter:       libreport-2.17.11
executable:     /usr/lib/python3.12/site-packages/argcomplete/_check_console_script.py
uid:            1000
cgroup:         0::/user.slice/user-1000.slice/user/app.slice/app-org.gnome.Terminal.slice/vte-spawn-823f1d72-1d0e-44a9-aad2-dd6fbfe4d452.scope
crash_function: __getitem__
cmdline:        /usr/bin/python3 -m argcomplete._check_console_script /usr/bin/koji-rpmfusion
comment:        Occurs when I use fedpkg or rfpkg command.
runlevel:       N 5
interpreter:    python3-3.12.0~rc1-1.fc39.x86_64
kernel:         6.5.0-0.rc5.20230808git14f9643dc90a.37.fc39.x86_64
exception_type: StopIteration
type:           Python3
package:        python3-argcomplete-2.0.0-10.fc39
reason:         __init__.py:287:__getitem__:KeyError: 'console_scripts'

Comment 17 leigh scott 2023-09-07 08:10:29 UTC
using rfpkg and koji-rpmfusion command


reporter:       libreport-2.17.11
executable:     /usr/lib/python3.12/site-packages/argcomplete/_check_console_script.py
uid:            1000
cgroup:         0::/user.slice/user-1000.slice/user/app.slice/app-org.gnome.Terminal.slice/vte-spawn-8091ff98-fb09-41b8-a1c6-55cc868e1beb.scope
crash_function: __getitem__
cmdline:        /usr/bin/python3 -m argcomplete._check_console_script /usr/bin/rfpkg
comment:        using rfpkg and koji-rpmfusion command
runlevel:       N 5
interpreter:    python3-3.12.0~rc1-1.fc39.x86_64
kernel:         6.5.0-57.fc39.x86_64
exception_type: StopIteration
type:           Python3
package:        python3-argcomplete-2.0.0-11.fc39
reason:         __init__.py:287:__getitem__:KeyError: 'console_scripts'

Comment 18 leigh scott 2023-09-07 08:13:00 UTC
I still get the issue with the fixed version.

Comment 19 Kamil Páral 2023-09-14 11:18:39 UTC
Trying to autocomplete "koji downl<tab>"


reporter:       libreport-2.17.11
kernel:         6.5.3-300.fc39.x86_64
cmdline:        /usr/bin/python3 -m argcomplete._check_console_script /usr/bin/koji
cgroup:         0::/user.slice/user-1000.slice/user/app.slice/app-org.gnome.Terminal.slice/vte-spawn-ee64f5b7-c328-4fba-8ac2-ed125a1de973.scope
uid:            1000
reason:         __init__.py:287:__getitem__:KeyError: 'console_scripts'
executable:     /usr/lib/python3.12/site-packages/argcomplete/_check_console_script.py
type:           Python3
package:        python3-argcomplete-2.0.0-11.fc39
runlevel:       N 5
exception_type: StopIteration
crash_function: __getitem__
interpreter:    python3-3.12.0~rc2-1.fc39.x86_64
comment:        Trying to autocomplete "koji downl<tab>"

Comment 20 Miro Hrončok 2023-09-14 12:16:16 UTC
The patch we packported https://github.com/kislyuk/argcomplete/commit/f4d046c0cec1dab17f65853442b1da7d341e2915 makes an assumption:

    # The importlib_metadata backport returns a tuple of entry point objects
    # whereas the official library returns a SelectableGroups object
    if not use_entry_points_backport:
        entry_points = entry_points["console_scripts"] # type:ignore

However, the Python 3.12 "official library" returns a tuple as well. Observe:

$ python3  # on Fedora 38
Python 3.11.5 (main, Aug 28 2023, 00:00:00) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.metadata import entry_points as importlib_entry_points
>>> entry_points = importlib_entry_points()
>>> entry_points
{'babel.checkers': [EntryPoint(name='num_plurals', value='babel.messages.checkers:num_plurals', group='babel.checkers'), ...}
>> entry_points["console_scripts"]
<stdin>:1: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
[EntryPoint(name='distro', value='distro.distro:main', group='console_scripts'), ...]


$ python3  # on Fedora 39
Python 3.12.0rc1 (main, Aug  7 2023, 00:00:00) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.metadata import entry_points as importlib_entry_points
>>> entry_points = importlib_entry_points()
>>> entry_points
(EntryPoint(name='cffi_modules', value='cffi.setuptools_ext:cffi_modules', group='distutils.setup_keywords'), ...)
>>> entry_points["console_scripts"]
Traceback (most recent call last):
  File "/usr/lib64/python3.12/importlib/metadata/__init__.py", line 285, in __getitem__
    return next(iter(self.select(name=name)))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.12/importlib/metadata/__init__.py", line 287, in __getitem__
    raise KeyError(name)
KeyError: 'console_scripts'

Comment 21 Miro Hrončok 2023-09-14 12:41:31 UTC
I'd appreciate it if you could test the probable fix:

https://src.fedoraproject.org/rpms/python-argcomplete/pull-request/20 (rawhide)
https://src.fedoraproject.org/rpms/python-argcomplete/pull-request/21 (f39)

Comment 22 Miro Hrončok 2023-09-14 12:49:17 UTC
I downloaded Fedora-Workstation-Live-x86_64-39-20230914.n.0.iso and booted it up.

Apparently, it contains python3-argcomplete, so let's request a freeze exception.


  liveuser@localhost-live:~$ rpm -q python3-argcomplete
  python3-argcomplete-2.0.0-11.fc39.noarch

I'll try to figure out what uses argcomplete there and try to reproduce the problem and test the fix.

Comment 23 Miro Hrončok 2023-09-14 12:54:38 UTC
liveuser@localhost-live:~$ dnf repoquery --installed --whatrequires python3-argcomplete
abrt-tui-0:2.17.1-3.fc39.noarch

liveuser@localhost-live:~$ rpm -ql abrt-tui | grep /bin
/usr/bin/abrt
/usr/bin/abrt-cli


abrt(-cli) is not a console script entyrpoint. I cannot reproduce a crash with it.



Installing /usr/bin/koji and trying `koji downl<tab>` -- I still cannot reproduce the crash :(

Comment 24 Maxwell G 2023-09-16 21:52:50 UTC
I cannot reproduce this failure either. I tested with multiple packages that provide argcomplete completions scripts.

$ rpm -q koji python3-argcomplete bash-completion fedpkg ansible-core
koji-1.33.1-2.fc39.noarch
python3-argcomplete-2.0.0-11.fc40.noarch
bash-completion-2.11-12.fc39.noarch
fedpkg-1.44-6.fc39.noarch
ansible-core-2.15.4-1.fc40.noarch
$ koji download<tab>
download-build  download-logs   download-task
$ fedpkg cl<tab>
clean  clog   clone
$ ansible-playbook --f<tab>
--flush-cache     --force-handlers  --forks

Comment 25 Fedora Update System 2023-09-19 10:24:29 UTC
FEDORA-2023-36405da4ad has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-36405da4ad

Comment 26 Fedora Update System 2023-09-19 11:38:08 UTC
FEDORA-2023-36405da4ad has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 27 Fedora Update System 2023-09-19 13:11:35 UTC
FEDORA-2023-c08ad96e9c has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-c08ad96e9c

Comment 28 Fedora Update System 2023-09-20 02:07:06 UTC
FEDORA-2023-c08ad96e9c has been pushed to the Fedora 39 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-c08ad96e9c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-c08ad96e9c

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

Comment 29 Jani Heinonen 2023-09-20 07:14:44 UTC
This is a fresh install of Fedora39 KDE spin and looking at the time of the error, it has happened right after the install or on the initial updates.


reporter:       libreport-2.17.11
kernel:         6.5.2-301.fc39.x86_64
cmdline:        /usr/bin/python3 -m argcomplete._check_console_script /usr/bin/dnf
cgroup:         0::/user.slice/user-1000.slice/session-4.scope
uid:            0
reason:         __init__.py:287:__getitem__:KeyError: 'console_scripts'
executable:     /usr/lib/python3.12/site-packages/argcomplete/_check_console_script.py
type:           Python3
package:        python3-argcomplete-2.0.0-11.fc39
runlevel:       N 5
exception_type: StopIteration
crash_function: __getitem__
interpreter:    python3-3.12.0~rc1-1.fc39.x86_64
comment:        This is a fresh install of Fedora39 KDE spin and looking at the time of the error, it has happened right after the install or on the initial updates.

Comment 30 Jani Heinonen 2023-09-20 07:36:41 UTC
Did not notice the fix, so my report is not usefull anymore. I apologize for the extra report and will try the fix later, it was not available yet for me

Comment 31 Sandro Bonazzola 2023-09-20 07:50:31 UTC
in a gnome-terminal, write `meld` and hit `tab` key for triggering autocompletion


reporter:       libreport-2.17.11
kernel:         6.5.3-300.fc39.x86_64
cmdline:        /usr/bin/python3 -m argcomplete._check_console_script /usr/bin/meld
cgroup:         0::/user.slice/user-20528.slice/user/app.slice/app-org.gnome.Terminal.slice/vte-spawn-e4b10005-c035-4d37-95d0-8ddfc061f284.scope
uid:            0
reason:         __init__.py:287:__getitem__:KeyError: 'console_scripts'
executable:     /usr/lib/python3.12/site-packages/argcomplete/_check_console_script.py
type:           Python3
package:        python3-argcomplete-2.0.0-11.fc39
runlevel:       N 5
exception_type: StopIteration
crash_function: __getitem__
interpreter:    python3-3.12.0~rc2-1.fc39.x86_64
comment:        in a gnome-terminal, write `meld` and hit `tab` key for triggering autocompletion

Comment 32 Sandro Bonazzola 2023-09-20 07:57:36 UTC
Verified fixed with python-argcomplete-2.0.0-12.fc39 following reproduction steps both in #c0 and #c31

Comment 33 Fedora Update System 2023-09-21 00:16:09 UTC
FEDORA-2023-c08ad96e9c has been pushed to the Fedora 39 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.