micro-editor / micro-editor/micro

Runtime error after answering “yes” to save with sudo

Open
#1,348 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Description of the problem or steps to reproduce

  1. Open a file you don’t have write permission to
  2. Try to save the file
  3. Answer “y” to the prompt: Permission denied. Do you want to save this file using sudo?
  4. The program crashes and prints a message like this:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x4c pc=0x236db8]

goroutine 20 [running]:
panic(0x5c0880, 0x10b26030)
	/usr/lib/go-1.6/src/runtime/panic.go:481 +0x330
github.com/zyedidia/micro/cmd/micro/vendor/github.com/zyedidia/tcell.(*tScreen).PollEvent(0x0, 0x0, 0x0)
	/build/b68dc646faa0c5dccca78d8c5d88c0fa-xenial/parts/micro/go/src/github.com/zyedidia/micro/cmd/micro/vendor/github.com/zyedidia/tcell/tscreen.go:801 +0x20
main.main.func5()
	/build/b68dc646faa0c5dccca78d8c5d88c0fa-xenial/parts/micro/go/src/github.com/zyedidia/micro/cmd/micro/micro.go:454 +0x3c
created by main.main
	/build/b68dc646faa0c5dccca78d8c5d88c0fa-xenial/parts/micro/go/src/github.com/zyedidia/micro/cmd/micro/micro.go:457 +0x2400

The crash only occurs sometimes. I have not been able to pinpoint the cause.

I’m using micro over SSH.

Specifications

Micro version: 1.4.0 (commit af520cf), installed via snap
OS: Raspbian 9.8 Stretch (Linux 4.14.98-v7+)
Hardware: Raspberry Pi 3B (revision 1.2)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cmd/micro/micro.go around the goroutine at line 454 and inspect the tcell PollEvent call reported in vendor/github.com/zyedidia/tcell/tscreen.go:801. Reproduce the sudo-save flow over SSH, then determine what prevents the nil-pointer panic from recurring and verify the editor remains usable after answering yes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.