Bug 2391023 - fedpkg: argcomplete script dumped to terminal on tab press
Summary: fedpkg: argcomplete script dumped to terminal on tab press
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: fedpkg
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ondřej Nosek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-08-26 13:16 UTC by Miro Hrončok
Modified: 2025-12-14 01:00 UTC (History)
11 users (show)

Fixed In Version: fedpkg-1.47-2.fc43
Clone Of:
Environment:
Last Closed: 2025-12-14 01:00:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources fedpkg pull-request 38 0 None None None 2025-09-06 21:20:53 UTC

Description Miro Hrončok 2025-08-26 13:16:54 UTC
With:

python3-argcomplete-3.6.2-6.fc44.noarch
bash-completion-2.16-2.fc43.noarch
bash-5.3.0-2.fc43.x86_64
fedpkg-1.46-6.fc44.noarch

In a fresh Fedora rawhide container. However, also happens on my Fedora 41 with:

python3-argcomplete-3.6.2-2.fc41.noarch
bash-completion-2.16-1.fc41.noarch
bash-5.2.32-1.fc41.x86_64
fedpkg-1.46-4.fc41.noarch




Put this in the Bash prompt:

for i in {1..10}; do fedpkg --release f43 build --nowait --scratch --f[CURSOR HERE] ; done

Press tab. The output of the Bash completions script floods the terminal.


Expected behavior: --fail-fast is completed.

Comment 1 Sandro 2025-09-06 14:00:34 UTC
This appears to be an issue with fedpkg's implementation of argcomplete. Since fedpkg is using rpkg's ArgumentParser I'm not sure if that needs to be fixed in fedpkg or rpkg.

With pytest, which also uses argcomplete, auto completion works fine in the same context:

for i in {1..10}; do pytest --run[TAB]

I'm not sure how to debug this further. Setting _ARC_DEBUG=1 doesn't appear to work inside the for loop construct. It just shows the Bash completion script without any debug information (or simply completes the argument in case of pytest).

Comment 2 Sandro 2025-09-06 21:20:53 UTC
It turns out fedpkg-completion supplies a completion script (/usr/share/bash-completion/completions/fedpkg.bash) that appears to fail when argcomplete falls back to readline. The completion script is a single line:

register-python-argcomplete fedpkg

That doesn't work and results in the output of 'register-python-argcomplete fedpkg' being dumped in the terminal. It needs to be either 'eval "$(register-python-argcomplete fedpkg)"' as per argcomplete documentation [1], or, in line with other packages (e.g. fedrq) the output of 'register-python-argcomplete fedpkg'.

I tried both. Though, putting the static completion script into that file seems to be the better approach and probably speeds things up a little as well.

[1] https://kislyuk.github.io/argcomplete/#synopsis

Comment 3 Miro Hrončok 2025-11-03 13:53:28 UTC
Ondřej, would you please respond to the proposed PR?

Comment 4 Fedora Update System 2025-12-09 15:49:45 UTC
FEDORA-2025-3a77b42326 (fedpkg-1.47-2.fc43 and rpkg-1.69-3.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-3a77b42326

Comment 5 Fedora Update System 2025-12-10 01:52:46 UTC
FEDORA-2025-3a77b42326 has been pushed to the Fedora 43 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-3a77b42326`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-3a77b42326

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

Comment 6 Fedora Update System 2025-12-14 01:00:09 UTC
FEDORA-2025-3a77b42326 (fedpkg-1.47-2.fc43 and rpkg-1.69-4.fc43) has been pushed to the Fedora 43 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.