zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.42k stars 1.16k forks source link

Cannot write to device specific files on linux #3139

Closed ITesserakt closed 4 months ago

ITesserakt commented 4 months ago

Description of the problem or steps to reproduce

  1. Run micro <device specific file> (in my case /sys/class/backlight/nvidia_0/brightness) from non-root environment.
  2. Replace value with smth else
  3. Try to save file via ctrl-s (accept sudo mode)
  4. Expected: file saved and modifications applied, actual: micro crashed, but changes were saved

Specifications

Stack trace:

Micro encountered an error: runtime.errorString runtime error: invalid memory address or nil pointer dereference
runtime/panic.go:261 (0x452e98)
runtime/panic.go:260 (0x452e66)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:403 (0x8f41ec)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:394 (0x8f3fec)
runtime/internal/atomic/types.go:194 (0x43e85b)
runtime/asm_amd64.s:1650 (0x46fbc1)

Commit hash: v2.0.12 OS: Linux nixos 6.7.4 #1-NixOS SMP PREEMPT_DYNAMIC Mon Feb 5 20:17:12 UTC 2024 x86_64 GNU/Linux Terminal: WezTerm 20230712-072601-f4abf8fd

JoeKar commented 4 months ago

Please try the same with v2.0.13, because this looks like an issue already solved with #2967.

ITesserakt commented 4 months ago

Tried out micro v2.0.13. On step 3, micros says: exit status 1 in status bar. So, no crash happened, i'm satisfied.