lxc / incus

Powerful system container and virtual machine manager
https://linuxcontainers.org/incus
Apache License 2.0
2.75k stars 225 forks source link

incorrect path for default editor #1389

Open thomasrdean opened 16 hours ago

thomasrdean commented 16 hours ago

Required information

Issue description

incus project edit default produces the error message Error: fork/exec /user/bin/vi: no such file or directory

I know I can fix it by defining the environment variable EDITOR. But I think it is a spelling error since I don't know of any unix distribution in which vi is in /user/bin.

Steps to reproduce

  1. Step one
  2. Step two
  3. Step three

Information to attach

stgraber commented 12 hours ago

https://github.com/lxc/incus/blob/main/cmd/incus/utils.go#L428

That's the logic for finding the text editor. We don't actually hardcode any path in there at all.

We do first try the env variables (VISUAL and EDITOR).

After that, we iterate over common text editor names and tell Go to look them up in the PATH through exec.LookPath.

If Go returns a path, we then execute that, if no path is returned, we return an error saying that no text editor could be found.

The error you're getting would be consistent with either VISUAL or EDITOR being set to a bad value in your environment.