You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sudo apt install commands aren't fixed correctly. The package I wanted to install is discarded, and something else is substitutued in it's place.
It appears to be skipping apt_invalid_operation, and pulling some random line from history to suggest instead. The suggestions are all commands I've executed in the past.
This only seems to occur when using sudo or multiple typos are present.
Example output
Note that the commands are what I actually executed
Command
Suggestion
at instal thing
sudo apt install libpango
sudo apt instal instal
sudo apt install wine-stable
sudo apt instal very_long_package_name
sudo apt install pwgen
Output of thefuck --version
The Fuck 3.28 using Python 3.6.7 and Bash 4.4.19(1)-release
The issue seems to be that apt_invalid_operation fails it's match. If I disable all other packages (using rules=['apt_invalid_operation']), then the output is always 'No fucks given'.
Further testing with a copy of apt_invalid_operation installed as a custom rule showed that removing the for_app decorator fixed the issue. (specifically, the line @for_app('apt') on the match function).
Okay, I found the problem. This was caused by the order of for_app and sudo_support.
The ordering in apt_invalid_operation (and also dnf_no_such_command) was wrong, and meant that the input to for_app contained a sudo prefix, and would fail.
Issue
sudo apt install
commands aren't fixed correctly. The package I wanted to install is discarded, and something else is substitutued in it's place.It appears to be skipping
apt_invalid_operation
, and pulling some random line from history to suggest instead. The suggestions are all commands I've executed in the past.This only seems to occur when using
sudo
or multiple typos are present.Example output
Note that the commands are what I actually executed
Output of
thefuck --version
System
Reproducing
~$ sudo apt instal i7z
~$ fuck
Output
~$ sudo apt instal i7z E: Invalid operation instal
thefuck Debug Output
https://gist.github.com/chrisdepas/5efe6dcb5c8990f2dff39413ac15575d
Other Useful Information
The issue seems to be that
apt_invalid_operation
fails it's match. If I disable all other packages (usingrules=['apt_invalid_operation']
), then the output is always 'No fucks given'.Further testing with a copy of
apt_invalid_operation
installed as a custom rule showed that removing thefor_app
decorator fixed the issue. (specifically, the line@for_app('apt')
on the match function).I.e. with this config
rules = ["apt_invalid_operation"]
I get this output:
However, testing a copy of
apt_invalid_operation
as a custom rule with for_app removedrules = ["new_apt_invalid_op"]
Gives this output
The text was updated successfully, but these errors were encountered: