Open elig0n opened 3 years ago
I am getting the same thing and also have zsh, zsh bug? The Fuck 3.30 using Python 3.9.1 and ZSH 5.8
EDIT: Probably not zsh, tried in bash and the same thing is happening
fuck -d
log
I got this "fixed" for now by deleting fix_file
rule, /usr/lib/python3.9/site-packages/thefuck/rules/fix_file.py
Instead of deleting the rule file, you can exclude that rule, using either the config file or the environment variable.
Refer thefuck#settings
I have observed the same behavior under Fish too. Excluding the rule fix_file
, as suggested by @wereii and @divykj solves the issue for me.
Hello,
I have the same problem. Every suggestion from TF ends with:
❯ pacmn
zsh: command not found: pacmn
❯ vim /bin/sh +1 && pacmn
Excluding fix_file
ends with:
❯ fuck
[WARN] Can't load settings from file:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/thefuck/conf.py", line 25, in init
self.update(self._settings_from_file())
File "/usr/lib/python3.9/site-packages/thefuck/conf.py", line 69, in _settings_from_file
settings = load_source(
File "/usr/lib/python3.9/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/waldauf/.config/thefuck/settings.py", line 12, in <module>
exclude_rules = [fix_file]
NameError: name 'fix_file' is not defined
----------------------------
No fucks given
This is how the TF behaves for several months. It doesn't work at all. I'm not sure if is the same problem as reported @elig0n but the symptom is the same.
Hello,
I have the same problem. Every suggestion from TF ends with:
❯ pacmn zsh: command not found: pacmn ❯ vim /bin/sh +1 && pacmn
Excluding
fix_file
ends with:❯ fuck [WARN] Can't load settings from file: Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/thefuck/conf.py", line 25, in init self.update(self._settings_from_file()) File "/usr/lib/python3.9/site-packages/thefuck/conf.py", line 69, in _settings_from_file settings = load_source( File "/usr/lib/python3.9/imp.py", line 171, in load_source module = _load(spec) File "<frozen importlib._bootstrap>", line 711, in _load File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/home/waldauf/.config/thefuck/settings.py", line 12, in <module> exclude_rules = [fix_file] NameError: name 'fix_file' is not defined ---------------------------- No fucks given
This is how the TF behaves for several months. It doesn't work at all. I'm not sure if is the same problem as reported @elig0n but the symptom is the same.
@waldauf
I think you need to quote fix_file
, i.e.
exclude_rules = [ "fix_file" ]
@elig0n
I think you need to quote
fix_file
, i.e.exclude_rules = [ "fix_file" ]
It seems to me that this is the right cure! Thank you for your help. :]
I wish I could reproduce this one, but unfortunately I can't. It would be super helpful if the output of thefuck with export THEFUCK_DEBUG=true
could please be posted by any of you still facing this issue.
Okay, I just tried and thankfully it worked 😄
DEBUG: Run with settings: {'alter_history': True,
'debug': True,
'env': {'GIT_TRACE': '1', 'LANG': 'C', 'LC_ALL': 'C'},
'exclude_rules': [],
'excluded_search_path_prefixes': [],
'history_limit': None,
'instant_mode': False,
'no_colors': False,
'num_close_matches': 3,
'priority': {},
'repeat': False,
'require_confirmation': True,
'rules': [<const: All rules enabled>],
'slow_commands': ['lein', 'react-native', 'gradle', './gradlew', 'vagrant'],
'user_dir': PosixPath('/home/corentin/.config/thefuck'),
'wait_command': 3,
'wait_slow_command': 15}
DEBUG: Received output: /bin/sh: line 1: fasd_cd: command not found
DEBUG: Call: z sds front; with env: { <!-- removed --> }; is slow: False took: 0:00:00.002547
DEBUG: Importing rule: adb_unknown_command; took: 0:00:00.000225
DEBUG: Importing rule: ag_literal; took: 0:00:00.000224
DEBUG: Importing rule: apt_get; took: 0:00:00.000610
DEBUG: Importing rule: apt_get_search; took: 0:00:00.000146
DEBUG: Importing rule: apt_invalid_operation; took: 0:00:00.000324
DEBUG: Importing rule: apt_list_upgradable; took: 0:00:00.000151
DEBUG: Importing rule: apt_upgrade; took: 0:00:00.000246
DEBUG: Importing rule: aws_cli; took: 0:00:00.000144
DEBUG: Importing rule: az_cli; took: 0:00:00.000134
DEBUG: Importing rule: brew_cask_dependency; took: 0:00:00.000349
DEBUG: Importing rule: brew_install; took: 0:00:00.000110
DEBUG: Importing rule: brew_link; took: 0:00:00.000137
DEBUG: Importing rule: brew_reinstall; took: 0:00:00.000400
DEBUG: Importing rule: brew_uninstall; took: 0:00:00.000141
DEBUG: Importing rule: brew_unknown_command; took: 0:00:00.000115
DEBUG: Importing rule: brew_update_formula; took: 0:00:00.000132
DEBUG: Importing rule: cargo; took: 0:00:00.000085
DEBUG: Importing rule: cargo_no_command; took: 0:00:00.000129
DEBUG: Importing rule: cat_dir; took: 0:00:00.000130
DEBUG: Importing rule: cd_correction; took: 0:00:00.000526
DEBUG: Importing rule: cd_cs; took: 0:00:00.000094
DEBUG: Importing rule: cd_mkdir; took: 0:00:00.000202
DEBUG: Importing rule: cd_parent; took: 0:00:00.000091
DEBUG: Importing rule: chmod_x; took: 0:00:00.000088
DEBUG: Importing rule: choco_install; took: 0:00:00.000274
DEBUG: Importing rule: composer_not_command; took: 0:00:00.000229
DEBUG: Importing rule: conda_mistype; took: 0:00:00.000203
DEBUG: Importing rule: cp_create_destination; took: 0:00:00.000191
DEBUG: Importing rule: cp_omitting_directory; took: 0:00:00.000219
DEBUG: Importing rule: cpp11; took: 0:00:00.000177
DEBUG: Importing rule: dirty_untar; took: 0:00:00.001946
DEBUG: Importing rule: dirty_unzip; took: 0:00:00.001364
DEBUG: Importing rule: django_south_ghost; took: 0:00:00.000124
DEBUG: Importing rule: django_south_merge; took: 0:00:00.000137
DEBUG: Importing rule: dnf_no_such_command; took: 0:00:00.000484
DEBUG: Importing rule: docker_image_being_used_by_container; took: 0:00:00.000144
DEBUG: Importing rule: docker_login; took: 0:00:00.000129
DEBUG: Importing rule: docker_not_command; took: 0:00:00.000261
DEBUG: Importing rule: dry; took: 0:00:00.000092
DEBUG: Importing rule: fab_command_not_found; took: 0:00:00.000150
DEBUG: Importing rule: fix_alt_space; took: 0:00:00.000127
DEBUG: Importing rule: fix_file; took: 0:00:00.001406
DEBUG: Importing rule: gem_unknown_command; took: 0:00:00.000273
DEBUG: Importing rule: git_add; took: 0:00:00.000277
DEBUG: Importing rule: git_add_force; took: 0:00:00.000124
DEBUG: Importing rule: git_bisect_usage; took: 0:00:00.000125
DEBUG: Importing rule: git_branch_delete; took: 0:00:00.000119
DEBUG: Importing rule: git_branch_delete_checked_out; took: 0:00:00.000121
DEBUG: Importing rule: git_branch_exists; took: 0:00:00.000127
DEBUG: Importing rule: git_branch_list; took: 0:00:00.000118
DEBUG: Importing rule: git_checkout; took: 0:00:00.000184
DEBUG: Importing rule: git_clone_git_clone; took: 0:00:00.000175
DEBUG: Importing rule: git_commit_amend; took: 0:00:00.000259
DEBUG: Importing rule: git_commit_reset; took: 0:00:00.000124
DEBUG: Importing rule: git_diff_no_index; took: 0:00:00.000126
DEBUG: Importing rule: git_diff_staged; took: 0:00:00.000117
DEBUG: Importing rule: git_fix_stash; took: 0:00:00.000124
DEBUG: Importing rule: git_flag_after_filename; took: 0:00:00.000163
DEBUG: Importing rule: git_help_aliased; took: 0:00:00.000122
DEBUG: Importing rule: git_hook_bypass; took: 0:00:00.000126
DEBUG: Importing rule: git_lfs_mistype; took: 0:00:00.000121
DEBUG: Importing rule: git_merge; took: 0:00:00.000121
DEBUG: Importing rule: git_merge_unrelated; took: 0:00:00.000116
DEBUG: Importing rule: git_not_command; took: 0:00:00.000117
DEBUG: Importing rule: git_pull; took: 0:00:00.000122
DEBUG: Importing rule: git_pull_clone; took: 0:00:00.000116
DEBUG: Importing rule: git_pull_uncommitted_changes; took: 0:00:00.000117
DEBUG: Importing rule: git_push; took: 0:00:00.000121
DEBUG: Importing rule: git_push_different_branch_names; took: 0:00:00.000116
DEBUG: Importing rule: git_push_force; took: 0:00:00.000119
DEBUG: Importing rule: git_push_pull; took: 0:00:00.000119
DEBUG: Importing rule: git_push_without_commits; took: 0:00:00.000211
DEBUG: Importing rule: git_rebase_merge_dir; took: 0:00:00.000128
DEBUG: Importing rule: git_rebase_no_changes; took: 0:00:00.000139
DEBUG: Importing rule: git_remote_delete; took: 0:00:00.000161
DEBUG: Importing rule: git_remote_seturl_add; took: 0:00:00.000106
DEBUG: Importing rule: git_rm_local_modifications; took: 0:00:00.000120
DEBUG: Importing rule: git_rm_recursive; took: 0:00:00.000118
DEBUG: Importing rule: git_rm_staged; took: 0:00:00.000116
DEBUG: Importing rule: git_stash; took: 0:00:00.000117
DEBUG: Importing rule: git_stash_pop; took: 0:00:00.000117
DEBUG: Importing rule: git_tag_force; took: 0:00:00.000116
DEBUG: Importing rule: git_two_dashes; took: 0:00:00.000114
DEBUG: Importing rule: go_run; took: 0:00:00.000203
DEBUG: Importing rule: go_unknown_command; took: 0:00:00.000240
DEBUG: Importing rule: gradle_no_task; took: 0:00:00.000473
DEBUG: Importing rule: gradle_wrapper; took: 0:00:00.000188
DEBUG: Importing rule: grep_arguments_order; took: 0:00:00.000191
DEBUG: Importing rule: grep_recursive; took: 0:00:00.000181
DEBUG: Importing rule: grunt_task_not_found; took: 0:00:00.000270
DEBUG: Importing rule: gulp_not_task; took: 0:00:00.000204
DEBUG: Importing rule: has_exists_script; took: 0:00:00.000144
DEBUG: Importing rule: heroku_multiple_apps; took: 0:00:00.000139
DEBUG: Importing rule: heroku_not_command; took: 0:00:00.000133
DEBUG: Importing rule: history; took: 0:00:00.000092
DEBUG: Importing rule: hostscli; took: 0:00:00.000159
DEBUG: Importing rule: ifconfig_device_not_found; took: 0:00:00.000181
DEBUG: Importing rule: java; took: 0:00:00.000414
DEBUG: Importing rule: javac; took: 0:00:00.000176
DEBUG: Importing rule: lein_not_task; took: 0:00:00.000163
DEBUG: Importing rule: ln_no_hard_link; took: 0:00:00.000129
DEBUG: Importing rule: ln_s_order; took: 0:00:00.000133
DEBUG: Importing rule: long_form_help; took: 0:00:00.000088
DEBUG: Importing rule: ls_all; took: 0:00:00.000125
DEBUG: Importing rule: ls_lah; took: 0:00:00.000171
DEBUG: Importing rule: man; took: 0:00:00.000130
DEBUG: Importing rule: man_no_space; took: 0:00:00.000131
DEBUG: Importing rule: mercurial; took: 0:00:00.000133
DEBUG: Importing rule: missing_space_before_subcommand; took: 0:00:00.000173
DEBUG: Importing rule: mkdir_p; took: 0:00:00.000123
DEBUG: Importing rule: mvn_no_command; took: 0:00:00.000129
DEBUG: Importing rule: mvn_unknown_lifecycle_phase; took: 0:00:00.000131
DEBUG: Importing rule: nixos_cmd_not_found; took: 0:00:00.000398
DEBUG: Importing rule: no_command; took: 0:00:00.000143
DEBUG: Importing rule: no_such_file; took: 0:00:00.000090
DEBUG: Importing rule: npm_missing_script; took: 0:00:00.000286
DEBUG: Importing rule: npm_run_script; took: 0:00:00.000138
DEBUG: Importing rule: npm_wrong_command; took: 0:00:00.000160
DEBUG: Importing rule: omnienv_no_such_command; took: 0:00:00.000387
DEBUG: Importing rule: open; took: 0:00:00.000157
DEBUG: Importing rule: pacman; took: 0:00:00.000363
DEBUG: Importing rule: pacman_invalid_option; took: 0:00:00.000155
DEBUG: Importing rule: pacman_not_found; took: 0:00:00.000123
DEBUG: Importing rule: path_from_history; took: 0:00:00.000138
DEBUG: Importing rule: php_s; took: 0:00:00.000213
DEBUG: Importing rule: pip_install; took: 0:00:00.000138
DEBUG: Importing rule: pip_unknown_command; took: 0:00:00.000141
DEBUG: Importing rule: port_already_in_use; took: 0:00:00.000223
DEBUG: Importing rule: prove_recursively; took: 0:00:00.000154
DEBUG: Importing rule: python_command; took: 0:00:00.000128
DEBUG: Importing rule: python_execute; took: 0:00:00.000134
DEBUG: Importing rule: python_module_error; took: 0:00:00.000092
DEBUG: Importing rule: quotation_marks; took: 0:00:00.000101
DEBUG: Importing rule: react_native_command_unrecognized; took: 0:00:00.000166
DEBUG: Importing rule: remove_shell_prompt_literal; took: 0:00:00.000093
DEBUG: Importing rule: remove_trailing_cedilla; took: 0:00:00.000090
DEBUG: Importing rule: rm_dir; took: 0:00:00.000126
DEBUG: Importing rule: rm_root; took: 0:00:00.000125
DEBUG: Importing rule: scm_correction; took: 0:00:00.000146
DEBUG: Importing rule: sed_unterminated_s; took: 0:00:00.000183
DEBUG: Importing rule: sl_ls; took: 0:00:00.000142
DEBUG: Importing rule: ssh_known_hosts; took: 0:00:00.000378
DEBUG: Importing rule: sudo; took: 0:00:00.000122
DEBUG: Importing rule: sudo_command_from_user_path; took: 0:00:00.000144
DEBUG: Importing rule: switch_lang; took: 0:00:00.000155
DEBUG: Importing rule: systemctl; took: 0:00:00.000153
DEBUG: Importing rule: terraform_init; took: 0:00:00.000133
DEBUG: Importing rule: test.py; took: 0:00:00.000088
DEBUG: Importing rule: tmux; took: 0:00:00.000133
DEBUG: Importing rule: touch; took: 0:00:00.000129
DEBUG: Importing rule: tsuru_login; took: 0:00:00.000125
DEBUG: Importing rule: tsuru_not_command; took: 0:00:00.000129
DEBUG: Importing rule: unknown_command; took: 0:00:00.000085
DEBUG: Importing rule: unsudo; took: 0:00:00.000079
DEBUG: Importing rule: vagrant_up; took: 0:00:00.000132
DEBUG: Importing rule: whois; took: 0:00:00.000249
DEBUG: Importing rule: workon_doesnt_exists; took: 0:00:00.000159
DEBUG: Importing rule: yarn_alias; took: 0:00:00.000677
DEBUG: Importing rule: yarn_command_not_found; took: 0:00:00.000381
DEBUG: Importing rule: yarn_command_replaced; took: 0:00:00.000209
DEBUG: Importing rule: yarn_help; took: 0:00:00.000143
DEBUG: Importing rule: yum_invalid_operation; took: 0:00:00.000378
DEBUG: Trying rule: path_from_history; took: 0:00:00.000337
DEBUG: Trying rule: cd_cs; took: 0:00:00.000057
DEBUG: Trying rule: dry; took: 0:00:00.000003
DEBUG: Trying rule: git_hook_bypass; took: 0:00:00.000038
DEBUG: Trying rule: git_stash_pop; took: 0:00:00.000018
DEBUG: Trying rule: test.py; took: 0:00:00.000001
DEBUG: Trying rule: adb_unknown_command; took: 0:00:00.000008
DEBUG: Trying rule: ag_literal; took: 0:00:00.000016
DEBUG: Trying rule: aws_cli; took: 0:00:00.000014
DEBUG: Trying rule: az_cli; took: 0:00:00.000013
DEBUG: Trying rule: brew_link; took: 0:00:00.000015
DEBUG: Trying rule: brew_reinstall; took: 0:00:00.000013
DEBUG: Trying rule: brew_uninstall; took: 0:00:00.000012
DEBUG: Trying rule: brew_update_formula; took: 0:00:00.000013
DEBUG: Trying rule: cargo; took: 0:00:00.000001
DEBUG: Trying rule: cargo_no_command; took: 0:00:00.000014
DEBUG: Trying rule: cat_dir; took: 0:00:00.000014
DEBUG: Trying rule: cd_correction; took: 0:00:00.000019
DEBUG: Trying rule: cd_mkdir; took: 0:00:00.000018
DEBUG: Trying rule: cd_parent; took: 0:00:00.000001
DEBUG: Trying rule: chmod_x; took: 0:00:00.000001
DEBUG: Trying rule: composer_not_command; took: 0:00:00.000016
DEBUG: Trying rule: conda_mistype; took: 0:00:00.000014
DEBUG: Trying rule: cp_create_destination; took: 0:00:00.000013
DEBUG: Trying rule: cp_omitting_directory; took: 0:00:00.000018
DEBUG: Trying rule: cpp11; took: 0:00:00.000013
DEBUG: Trying rule: dirty_untar; took: 0:00:00.000013
DEBUG: Trying rule: dirty_unzip; took: 0:00:00.000013
DEBUG: Trying rule: django_south_ghost; took: 0:00:00.000001
DEBUG: Trying rule: django_south_merge; took: 0:00:00.000001
DEBUG: Trying rule: docker_image_being_used_by_container; took: 0:00:00.000013
DEBUG: Trying rule: docker_login; took: 0:00:00.000012
DEBUG: Trying rule: docker_not_command; took: 0:00:00.000017
DEBUG: Trying rule: fab_command_not_found; took: 0:00:00.000012
DEBUG: Trying rule: fix_alt_space; took: 0:00:00.000009
DEBUG: Trying rule: fix_file; took: 0:00:00.000020
vim /bin/sh +1 && fasd_cd -d sds front [enter/↑/↓/ctrl+c]
I removed my env vars but I kept the whole logs too, so if you need more information I'll be willing to give you non sensitive env vars.
Thanks for the update, @Drarig29!
...
DEBUG: Run with settings: {'alter_history': True, 'debug': True, 'env': {'GIT_TRACE': '1', 'LANG': 'C', 'LC_ALL': 'C'}, 'exclude_rules': [], 'excluded_search_path_prefixes': [], 'history_limit': None, 'instant_mode': False, 'no_colors': False, 'num_close_matches': 3, 'priority': {}, 'repeat': False, 'require_confirmation': True, 'rules': [<const: All rules enabled>], 'slow_commands': ['lein', 'react-native', 'gradle', './gradlew', 'vagrant'], 'user_dir': PosixPath('/home/corentin/.config/thefuck'), 'wait_command': 3, 'wait_slow_command': 15} DEBUG: Received output: /bin/sh: line 1: fasd_cd: command not found ... vim /bin/sh +1 && fasd_cd -d sds front [enter/↑/↓/ctrl+c]
...
The received output in fact matches one of the patterns in the fix_file
rule:
What needs an answer now is why is TheFuck getting such an output. Can you please share your setup? (OS, Shell, Python, with respective versions, etc.)
Thanks!
More recent versions of bash seem to include the line number in the error message. Such as on macos:
$ /usr/local/bin/bash -c fasd_cd
/usr/local/bin/bash: line 1: fasd_cd: command not found
$ /usr/local/bin/bash --version
GNU bash, version 5.1.8(1)-release (x86_64-apple-darwin19.6.0)
Copyright (C) 2020 Free Software Foundation, Inc.
...
or on Arch Linux:
$ /bin/sh -c fasd_cd
/bin/sh: line 1: fasd_cd: command not found
eab1b0b65cf2# /bin/sh --version
GNU bash, version 5.1.8(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
...
Whereas some older don't:
$ /bin/sh -c fasd_cd
/bin/sh: fasd_cd: command not found
$ /bin/sh --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
fix_file
?
line 1:
and command not found
?Until it's still an issue, fix_file
can be either excluded or given a lower priority.
Same on Arch with Zsh
Hello, I have the same problem. Every suggestion from TF ends with:
❯ pacmn zsh: command not found: pacmn ❯ vim /bin/sh +1 && pacmn
Excluding
fix_file
ends with:❯ fuck [WARN] Can't load settings from file: Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/thefuck/conf.py", line 25, in init self.update(self._settings_from_file()) File "/usr/lib/python3.9/site-packages/thefuck/conf.py", line 69, in _settings_from_file settings = load_source( File "/usr/lib/python3.9/imp.py", line 171, in load_source module = _load(spec) File "<frozen importlib._bootstrap>", line 711, in _load File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/home/waldauf/.config/thefuck/settings.py", line 12, in <module> exclude_rules = [fix_file] NameError: name 'fix_file' is not defined ---------------------------- No fucks given
This is how the TF behaves for several months. It doesn't work at all. I'm not sure if is the same problem as reported @elig0n but the symptom is the same.
@waldauf I think you need to quote
fix_file
, i.e.exclude_rules = [ "fix_file" ]
Fixed with this
Here's a workaround using environment variables, e.g. in your .zshrc
:
# Workaround for <https://github.com/nvbn/thefuck/issues/1153>
export THEFUCK_EXCLUDE_RULES='fix_file'
The Fuck 3.30 using Python 3.9.1 and ZSH 5.8
Example:
a lot of first suggestions I receive show up with
vim /bin/sh +1 &&
before them which is tasteless . How can I skip or avoid this?