mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Be careful to not touch curses variables if cur_term is null
Curses variables like `enter_italics_mode` are secretly defined to dereference through the `cur_term` variable. Be sure we do not read or write these curses variables if cur_term is NULL. See #8873, #8875. Add a regression test.
This commit is contained in:
parent
1da952450f
commit
bd9c6a64e3
2 changed files with 22 additions and 0 deletions
|
@ -491,6 +491,11 @@ static void initialize_curses_using_fallbacks(const environment_t &vars) {
|
||||||
// Apply any platform-specific hacks to cur_term/
|
// Apply any platform-specific hacks to cur_term/
|
||||||
static void apply_term_hacks(const environment_t &vars) {
|
static void apply_term_hacks(const environment_t &vars) {
|
||||||
UNUSED(vars);
|
UNUSED(vars);
|
||||||
|
// Be careful, variables like "enter_italics_mode" are #defined to dereference through cur_term.
|
||||||
|
// See #8876.
|
||||||
|
if (!cur_term) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// Hack in missing italics and dim capabilities omitted from MacOS xterm-256color terminfo
|
// Hack in missing italics and dim capabilities omitted from MacOS xterm-256color terminfo
|
||||||
// Helps Terminal.app/iTerm
|
// Helps Terminal.app/iTerm
|
||||||
|
|
17
tests/pexpects/nullterm.py
Normal file
17
tests/pexpects/nullterm.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
from pexpect_helper import SpawnedProc
|
||||||
|
|
||||||
|
# Regression test for #8873.
|
||||||
|
# fish doesn't crash if TERM is unset.
|
||||||
|
env = os.environ.copy()
|
||||||
|
env.pop("TERM", None)
|
||||||
|
|
||||||
|
sp = SpawnedProc(env=env)
|
||||||
|
sendline, expect_prompt = sp.sendline, sp.expect_prompt
|
||||||
|
|
||||||
|
expect_prompt()
|
||||||
|
sendline("set_color --italics")
|
||||||
|
expect_prompt()
|
||||||
|
sendline("set_color normal")
|
||||||
|
expect_prompt()
|
Loading…
Reference in a new issue