Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"sudo apt-get update && apt-get upgrade ; fuck" makes an error #837

Closed
Thibaut-Fontaine opened this issue Sep 10, 2018 · 3 comments
Closed
Assignees

Comments

@Thibaut-Fontaine
Copy link

Thibaut-Fontaine commented Sep 10, 2018

I updated thefuck and checked other issues.
Running on GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu) and ubuntu 18.04.1 LTS updated.

Run this :

sudo apt-get update && apt-get upgrade ; fuck

it will make :

Hit:1 http://fr.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 https://dl.yarnpkg.com/debian stable InRelease
Hit:3 http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:5 http://ppa.launchpad.net/webupd8team/java/ubuntu bionic InRelease
Hit:6 http://fr.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:7 http://fr.archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Traceback (most recent call last):
File "/home/thibaut/.local/lib/python3.6/site-packages/thefuck/output_readers/rerun.py", line 22, in _wait_output
else settings.wait_command)
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/init.py", line 1262, in wait
return self._proc.wait(timeout)
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/_pslinux.py", line 1459, in wrapper
return fun(self, *args, **kwargs)
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/_pslinux.py", line 1637, in wait
return _psposix.wait_pid(self.pid, timeout, self._name)
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/_psposix.py", line 104, in wait_pid
delay = check_timeout(delay)
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/_psposix.py", line 66, in check_timeout
raise TimeoutExpired(timeout, pid=pid, name=proc_name)
psutil._exceptions.TimeoutExpired: psutil.TimeoutExpired timeout after 3 seconds (pid=20029)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/init.py", line 1170, in _send_signal
os.kill(self.pid, sig)
PermissionError: [Errno 1] Operation not permitted

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/thefuck", line 11, in
sys.exit(main())
File "/home/thibaut/.local/lib/python3.6/site-packages/thefuck/entrypoints/main.py", line 25, in main
fix_command(known_args)
File "/home/thibaut/.local/lib/python3.6/site-packages/thefuck/entrypoints/fix_command.py", line 36, in fix_command
command = types.Command.from_raw_script(raw_command)
File "/home/thibaut/.local/lib/python3.6/site-packages/thefuck/types.py", line 82, in from_raw_script
output = get_output(script, expanded)
File "/home/thibaut/.local/lib/python3.6/site-packages/thefuck/output_readers/init.py", line 20, in get_output
return rerun.get_output(script, expanded)
File "/home/thibaut/.local/lib/python3.6/site-packages/thefuck/output_readers/rerun.py", line 47, in get_output
if _wait_output(result, is_slow):
File "/home/thibaut/.local/lib/python3.6/site-packages/thefuck/output_readers/rerun.py", line 26, in _wait_output
child.kill()
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/init.py", line 285, in wrapper
return fun(self, *args, **kwargs)
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/init.py", line 1244, in kill
self._send_signal(signal.SIGKILL)
File "/home/thibaut/.local/lib/python3.6/site-packages/psutil/init.py", line 1181, in _send_signal
raise AccessDenied(self.pid, self._name)
psutil._exceptions.AccessDenied: psutil.AccessDenied (pid=20030)

This seems weird to me, anyway this is an error.

@ghost
Copy link

ghost commented Sep 11, 2018

I just experienced this exact same problem, on Mint 19 Cinnamon.

The Fuck 3.27 using Python 3.6.5

@scorphus
Copy link
Collaborator

Thanks for reporting! This is kinda expected behavior, for the previous command takes longer than 3s to finish and times out. Only that AccessDenied exception needs to be excepted. Fix is on its way.

BTW, TheFuck is meant to fix the previous failed command, not the current one:

$ echoo ok; fuck
-su: echoo: command not found
No fucks given
$ echoo ok
-su: echoo: command not found
$ fuck
echo ok [enter/↑/↓/ctrl+c]
ok

@scorphus scorphus self-assigned this Sep 23, 2018
scorphus added a commit to scorphus/thefuck that referenced this issue Oct 2, 2018
nvbn pushed a commit that referenced this issue Oct 8, 2018
* #833: do not require sudo on TravisCI

* #N/A: Add Python dev releases to TravisCI pipeline

Inspired by Brett Cannon's advise [1].

    1: https://snarky.ca/how-to-use-your-project-travis-to-help-test-python-itself/

* #837: try and kill proc and its children

* #N/A: show shell information on `thefuck --version`

* #N/A: omit default arguments to get_close_matches

* #842: add settings var to control number of close matches

* #N/A: remove `n` from the list of `get_closest`'s args
@scorphus
Copy link
Collaborator

scorphus commented Jan 1, 2019

Oh. This is already fixed and should have been closed by one of those merged commits.

@scorphus scorphus closed this as completed Jan 1, 2019
riley-martine pushed a commit to riley-martine/thefuck that referenced this issue Dec 7, 2023
* nvbn#833: do not require sudo on TravisCI

* #N/A: Add Python dev releases to TravisCI pipeline

Inspired by Brett Cannon's advise [1].

    1: https://snarky.ca/how-to-use-your-project-travis-to-help-test-python-itself/

* nvbn#837: try and kill proc and its children

* #N/A: show shell information on `thefuck --version`

* #N/A: omit default arguments to get_close_matches

* nvbn#842: add settings var to control number of close matches

* #N/A: remove `n` from the list of `get_closest`'s args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants