Bug 2359689 - some completion scripts not working when python3-argcomplete is installed
Summary: some completion scripts not working when python3-argcomplete is installed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-argcomplete
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-04-15 07:15 UTC by Remi Collet
Modified: 2025-05-02 02:19 UTC (History)
10 users (show)

Fixed In Version: python-argcomplete-3.6.2-2.fc43 python-argcomplete-3.6.2-2.fc42 python-argcomplete-3.6.2-2.fc41 python-argcomplete-3.6.2-2.fc40
Clone Of:
Environment:
Last Closed: 2025-04-20 04:23:07 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-argcomplete pull-request 40 0 None None None 2025-04-17 08:15:39 UTC
Fedora Package Sources python-argcomplete pull-request 41 0 None None None 2025-04-17 10:06:05 UTC
Fedora Package Sources python-argcomplete pull-request 42 0 None None None 2025-04-17 10:06:05 UTC
Fedora Package Sources python-argcomplete pull-request 43 0 None None None 2025-04-17 10:06:05 UTC
Github kislyuk argcomplete issues 535 0 None open global bash completion breaks completion for some PHP scripts 2025-04-15 16:17:15 UTC

Description Remi Collet 2025-04-15 07:15:55 UTC
I maintain some package with completion scripts

- pie => /usr/share/bash-completion/completions/pie
- composer => /usr/share/bash-completion/completions/composer

These work as expected in Fedora <= 40 and Enterprise Linux

Since Fedora 41 they doesn't work anymore, and can't find anything wrong there

Other completion scripts work
a "source /usr/share/bash-completion/completions/pie" makes it working

Help welcome on this




Reproducible: Always

Comment 1 Remi Collet 2025-04-15 14:13:28 UTC
Reaffecting to python-argcomplete as the problem is related to /etc/bash_completion.d/_python-argcomplete

With old python3-argcomplete it was working as expected (f39)

Removing python3-argcomplete solves the issue (tested on F40 and F41)
Version 3.6.2 in testing is also affected

Comment 2 Remi Collet 2025-04-15 15:20:41 UTC
The problem is in 

           elif __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
                ARGCOMPLETE=1

As "/usr/bin/php -m"  is a valid command (modules list)

Comment 3 Miro Hrončok 2025-04-15 15:54:58 UTC
So the problem (if I understand it correctly) is the combination of:

 1. /etc/bash_completion.d/_python-argcomplete runs for everything
 2. the script runs $interpeter -m argcomplete._check_console_script "$SCRIPT_NAME" (assuming $interpreter is some kind of Python)
 3. php -m argcomplete._check_console_script "$SCRIPT_NAME" exists successfully
 4. argcomplete takes over the completion for some php scripts

correct?

Comment 4 Remi Collet 2025-04-16 05:42:14 UTC
> correct?

Yes.

Still digging.

/etc/bash_completion.d/_python-argcomplete contains

    complete -o default -o bashdefault -D -F _python_argcomplete_global

/usr/share/bash-completion/completions/pie contains

    complete -F _sf_pie pie

According to "complete" man page

    The -D option indicates  that  other  supplied options  and actions should apply to the ``default'' command completion;
    that is, completion attempted on a command for which no completion has previously been defined.

So _python-argcomplete should not be used for pie, which has a completion defined

So maybe a bash-completion issue or a load order issue.

Comment 5 Remi Collet 2025-04-16 05:49:56 UTC
So a possible fix

Moving _python-argcomplete from user directory (/etc) to system directory (/usr/) solves the load order issue

   mv /etc/bash_completion.d/_python-argcomplete /usr/share/bash-completion/completions/_python-argcomplete

- pie completion works
- virt-install (which use _python-argcomplete) works

Comment 6 Miro Hrončok 2025-04-16 08:50:40 UTC
Moving to /usr breaks argcomplete entirely (which is perhaps why it solves this). See bz2211862.

Comment 7 Miro Hrončok 2025-04-17 07:47:24 UTC
Fedora RPM-packaged scripts using argcompelte all have Python shebangs.

Hence, I wonder if getting rid of the entire book...

            elif __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
                ARGCOMPLETE=1
            fi

...(which is located in an elif branch for scripts without a Python shebang) would not be good enough for us, until an upstream solution is found.

Comment 8 Remi Collet 2025-04-17 08:09:54 UTC
As RHEL-10 is also affected, reported as https://issues.redhat.com/browse/RHEL-87652

Comment 9 Miro Hrončok 2025-04-17 08:15:40 UTC
Remi, please test the CI build of https://src.fedoraproject.org/rpms/python-argcomplete/pull-request/40 -- I'll check if it breaks Python scripts using argcomplete.

Comment 10 Fedora Update System 2025-04-17 09:45:19 UTC
FEDORA-2025-fa6b4108c4 (python-argcomplete-3.6.2-2.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-fa6b4108c4

Comment 11 Remi Collet 2025-04-17 10:02:37 UTC
Can you please also push the fix to stable branches (f40+) ?

Comment 12 Miro Hrončok 2025-04-17 10:06:06 UTC
Working on it.

Comment 13 Fedora Update System 2025-04-17 10:25:02 UTC
FEDORA-2025-8edf59c712 (python-argcomplete-3.6.2-2.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-8edf59c712

Comment 14 Fedora Update System 2025-04-17 10:25:05 UTC
FEDORA-2025-1cb3645cc2 (python-argcomplete-3.6.2-2.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-1cb3645cc2

Comment 15 Remi Collet 2025-04-17 10:49:49 UTC
(In reply to Miro Hrončok from comment #12)
> Working on it.

Thanks a lot for handling this bug and related updates

Comment 16 Miro Hrončok 2025-04-17 10:51:01 UTC
Thanks for the report and for finding the cause.

Comment 17 Fedora Update System 2025-04-17 11:15:56 UTC
FEDORA-2025-fa6b4108c4 (python-argcomplete-3.6.2-2.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 18 Fedora Update System 2025-04-17 21:04:32 UTC
FEDORA-2025-1516194d78 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-1516194d78`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-1516194d78

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

Comment 19 Fedora Update System 2025-04-17 21:48:46 UTC
FEDORA-2025-8edf59c712 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-8edf59c712`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-8edf59c712

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

Comment 20 Fedora Update System 2025-04-17 22:00:38 UTC
FEDORA-2025-1cb3645cc2 has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-1cb3645cc2`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-1cb3645cc2

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

Comment 21 Fedora Update System 2025-04-20 04:23:07 UTC
FEDORA-2025-1516194d78 (python-argcomplete-3.6.2-2.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 22 Fedora Update System 2025-04-21 16:47:13 UTC
FEDORA-2025-8edf59c712 (python-argcomplete-3.6.2-2.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 23 Fedora Update System 2025-05-02 02:19:25 UTC
FEDORA-2025-1cb3645cc2 (python-argcomplete-3.6.2-2.fc40) has been pushed to the Fedora 40 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.