Skip to content

Commit

Permalink
Fix behavior of list-updateinfo and related aliases
Browse files Browse the repository at this point in the history
Commit de9643a (first shipped in dnf 4.2.8) changed opts.command
from a list to a simple string, but code in UpdateInfoCommand still
handled it as if it was a list.

This broke silently because Python will iterate over a string character
by character, so it never produced a syntax error or an exception that
would be noticed.

But it broke behavior of the `list-updateinfo` form and other aliases,
since it would no longer detect that this alias was used and would use
the default action (`summary`) instead of the one triggered by the alias
(`list`).

Before this commit, this command would incorrectly return the updateinfo
summary only, instead of the full list:
  $ dnf list-updateinfo
  (same as `dnf updateinfo summary` output.)

After this commit:
  $ dnf list-updateinfo
  (same as `dnf updateinfo list` output.)

Closes: #1611
Approved by: m-blaha
  • Loading branch information
filbranden authored and rh-atomic-bot committed Apr 1, 2020
1 parent 1f00a5f commit e055d9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dnf/cli/commands/updateinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def configure(self):
self.cli.demands.available_repos = True
self.cli.demands.sack_activation = True

if self.opts.command[0] in self.direct_commands:
if self.opts.command in self.direct_commands:
# we were called with direct command
self.opts.spec_action = self.direct_commands[self.opts.command[0]]
self.opts.spec_action = self.direct_commands[self.opts.command]
else:
if self.opts._spec_action:
self.opts.spec_action = self.opts._spec_action
Expand Down

0 comments on commit e055d9b

Please sign in to comment.