Should programs that use the $EDITOR environment variable try to fork&exec it directly or interpret it as a shell command?

If I set EDITOR="emacsclient -t", some programs do the right thing while others complain that "emacsclient -t" can't be found in $PATH. I'm trying to decide whether to report bugs for some programs that take the latter path.

(Yes, I could stick a one-line script on my path somewhere, but that's not ideal.)

@petrichor According to environ(7) from the Linux Programmer’s Manual, “Any string acceptable as a command_string operand to the sh -c command shall be valid.” in EDITOR/VISUAL.

By the way, if you want to nitpick, tell them to use $VISUAL instead, because $EDITOR should be set to a line editor. 🤓

@tastytea Ah, thanks, that's good to know. I thought it would be something like that...

@petrichor In the name of all that's secure, please don't execute environment variables!

That's just insane.

@nomad @petrichor Any software that can make you run your favorite program with an altered $EDITOR can put a keylogger in the XDG autostart folder, set your default http handler to emacs and rewrite your .bashrc to call the cops.
Sign in to participate in the conversation
Scholar Social

Scholar Social is a microblogging platform for researchers, grad students, librarians, archivists, undergrads, academically inclined high schoolers, educators of all levels, journal editors, research assistants, professors, administrators—anyone involved in academia who is willing to engage with others respectfully.