Since set_color was changed to a built-in command, the entire shell will
exit in the event that setupterm() fails for some reason since ncurses
does an exit() if an errret was not passed in.
setupterm() can fail if the TERM environment variable is not set. This can
cause the shell to die prematurely if set_color is called from a startup
file like config.fish (such as vi-mode.fish which caches the results of
set_color when it is loaded) and fish is started without a TERM set
(e.g. when started from .xsession, or when being used as a remote shell
by a command such as rsync, scp or git)
A simple repro case for this issue is:
ian@delenn~ [i]> echo set_color normal > ~/.config/fish/config.fish
ian@delenn~ [i]> scp localhost:test .
TERM environment variable not set.
ian@delenn~ [i]>
This patch passes in an errret variable to setupterm(), which causes
ncurses to return the error to builtin_set_color() rather than calling
exit():
ian@delenn~ [i]> scp localhost:test .
test 100% 0 0.0KB/s 00:00
ian@delenn~ [i]>
Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
- Clarify wording in functions section
- Use the term aliases rather than wrappers
- Clarification of concepts and better? examples in variable expansion
- Likewise in environment variables
- Using the phrase builtin commands rather than builtins
- Tidy up keybindings a bit
- Another example in the history section
- Remove TODO section in favour of mailing list, GitHub and IRC link
The compiled-in path to bin dir was not correct; it made the
common assumption that `$(prefix)` == `$(prefix)/bin` which is
usually true, but not in all cases.
1. [machine specific files](http://www.gnu.org/prep/standards/html_node/Directory-Variables.html#index-exec_005fprefix)
should use `$(exec_prefix)` (`@exec_prefix@` in Makefile.in)
instead of the usual `$(prefix)`.
2. [executable programs](http://www.gnu.org/prep/standards/html_node/Directory-Variables.html#index-bindir)
should use the more-specific `$(bindir)` (`@bindir@` in Makefile.in)
instead of assuming `$(exec_prefix)/bin` as this allows the
executable install location to be changed with the
`--bindir=_foo_` option to `./configure`.
Fortunately, the makefile is mostly correct and *installs* the
executable in the correct location. The problem shows up later
such as during tab-completion, when fish_pager is run - the
compiled-in path it uses was the incorrect `$(prefix)/bin`
resulting in an "Unknown command" error, which only required
this small fix.