micro
micro copied to clipboard
Freezing on save with sudo
Freezing on save over a file that requires sudo
Quite often when trying to save a file that my user doesn't have permission to save, it freezes when after hitting save (F2 or Ctrl+S). It doesn't even get to the point when password is being asked. I have to restart the terminal because micro stays frozen.
This started to happen a few versions back at least, not related with current 2.0.10. If it helps, I'm on WSL.
Specifications
Version: 2.0.10 Commit hash: b9763856 Compiled on August 07, 2021
If you need sudo permissions to save, micro asks you for an input y/n you just have to type y on your keyboard and it's going to unfreeze.
Just tried again, lucky it was a time when it actually worked. It didn't ask me for any y/n input, just asked for the root password. When it doesn't work, it simply freezes without asking for anything.
Lately I have to run micro with sudo when I want to edit a priviledged file, because it freezes on the [Y/n] prompt. It stops accepting input and starts using my CPU, sometimes up to 20%. I have to force kill it and try again with sudo instead of using the prompt.
It stops accepting input and starts using my CPU, sometimes up to 20%. I have to force kill it and try again with sudo instead of using the prompt.
The same for me.
~$ uname -r
3.10.0
~$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
This just happened to me on Fedora 36, but I haven't been able to reproduce it. After pressing Ctrl+S, the editor view freezed, and nothing seemed to do anything. Sending a SIGTERM did close the editor, but the command did not complete and I had to send a SIGKILL as well.
This was on micro version 2.0.8 (installed from the distro's repository).
@schiorean Can you point me to that issue? This issue seemed to be the best match to the symptoms I experienced when I searched through all the issues.
@Igetin I erased my previous comment because I wrongly assumed am in another issue tracker. You are right and your problem is exactly as mine.
So I just did find a way to consistently reproduce this, and also on the latest micro version (2.0.11):
- Open a new shell session
- Create a test directory:
mkdir /tmp/testdir
- Make root the owner:
sudo chown root:root /tmp/testdir
- Start editing a non-existing file in the directory:
micro /tmp/testdir/testfile
- Go here and copy the file contents to your clipboard with the button
- Paste the clipboard contents to micro
- Press Ctrl+S to save
- The editor becomes unresponsive
This is also reproducible if the file already exists (with the aforementioned content), and you try to save the file without making any modifications. It definitely seems to have something to do with how much content a file has. I could not reproduce this with smaller files. Although it is very possible that there are multiple possible situations where the freeze occurs.
I reproduced this on another machine (Fedora 35) as well.
Thank you for the detailed instructions for reproducing. I have added a commit that fixes the issue. Please let me know if you still experience it after the most recent commit.
i'm experiencing this exact issue on the latest version from the arch repos, my editor just becomes unresponsive on the "do you want to save this file using sudo" prompt when trying to save the neofetch script (/usr/bin/neofetch) it is a very large file (well over 5k lines) as was pointed out in an above comment possibly being related to the issue
EDIT: im on version 2.0.11 (the latest version on arch) but it seems like it was compiled quite a while ago so i'll try building the latest commit from source and see if it fixes it
I am experiencing the exact same issue when attempting to sudo save a large file.
Ubuntu Subsystem Linux 20.04 For me it was the file: /usr/lib/python3/dist-packages/OpenSSL/crypto.py
micro -version: Version: 2.0.11 Commit hash: 225927b9 Compiled on August 01, 2022
@JoachimDunkel This is already fixed, but version 2.0.11 does not contain the fix. However, it is the latest release version as of writing.
If you want the fix before a new official release is available, you may build the application from the latest source.