Skip to content

Commit

Permalink
completion: avoid potential hangs in dnf_commands_helper()
Browse files Browse the repository at this point in the history
The completion helper can hang indefinitely waiting for user input
(which the user cannot see).  The --assumeno option ensures any prompts
are answered negatively.

Using the --nogpgcheck option avoids the helper downloading gpgkeys for
repos which have repo_gpgcheck=1 set.  This can speed up the completion
quite a bit.

Lastly, redirect input from /dev/null to ensure the completion_helper
command knows it has no controlling tty on which to wait for input.

Closes: #894
Approved by: m-blaha
  • Loading branch information
tmzullinger authored and rh-atomic-bot committed May 30, 2018
1 parent b49980a commit 36bf373
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion etc/bash_completion.d/dnf
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ _dnf_set_python_exec()

_dnf_commands_helper()
{
echo "$( ${__dnf_python_exec} -c "import sys; from dnf.cli import completion_helper as ch; ch.main(sys.argv[1:])" "$@" -d 0 -q -C 2>/dev/null )"
echo "$( ${__dnf_python_exec} -c "import sys; from dnf.cli import completion_helper as ch; ch.main(sys.argv[1:])" "$@" -d 0 -q -C --assumeno --nogpgcheck 2>/dev/null </dev/null )"
}

_dnf_is_path()
Expand Down

0 comments on commit 36bf373

Please sign in to comment.