|
Bugzilla – Full Text Bug Listing |
| Summary: | SUDO_EDITOR environment variable isn't recognized properly | ||
|---|---|---|---|
| Product: | Sudo | Reporter: | Michael <pvjc7naz0> |
| Component: | Visudo | Assignee: | Todd C. Miller <Todd.Miller> |
| Status: | RESOLVED INVALID | ||
| Severity: | low | ||
| Priority: | low | ||
| Version: | 1.9.5 | ||
| Hardware: | Macintosh | ||
| OS: | MacOS X | ||
|
Description
Michael
2021-02-01 07:34:35 MST
SUDO_VISUAL is not listed anywhere in the docs, you need to use SUDO_EDITOR. The variables are checked in the following order:
SUDO_EDITOR, VISUAL, EDITOR
The first one found is used.
The VISUAL environment variable isn't used much these days. It dates from the time when visual terminals were rare and the default editor (ed) was line-based.
You're right, I used the wrong variable. When I tried SUDO_EDITOR, I got the same result. [Veritas:~] mike$ echo $EDITOR /usr/local/bin/bbedit [Veritas:~] mike$ echo $VISUAL [Veritas:~] mike$ SUDO_EDITOR=/usr/bin/vi [Veritas:~] mike$ sudo visudo Password: error opening : Permission denied (application error code: 100013). bbedit: error: -31059 visudo: /etc/sudoers.tmp unchanged [Veritas:~] mike$ EDITOR= [Veritas:~] mike$ sudo visudo * * * works correctly * * * visudo: /etc/sudoers.tmp unchanged [Veritas:~] mike$ You didn't export the SUDO_EDITOR variable so it is not actually present in the environment. Try: export SUDO_EDITOR=/usr/bin/vi sudo visudo I just verified that this works as expected on macOS. Thank you for catching my mistake. Thank you for developing and maintaining this wonderful tool. --Michael |