From 27572c9d34907418c9c0b778aaf94e869236c1ac Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Mon, 24 May 2021 16:57:27 +0430 Subject: [PATCH] Base: Document the Shell's new termios allow-list Also add `stty` to that list by default. --- Base/etc/shellrc | 2 ++ Base/usr/share/man/man7/Shell-vars.md | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Base/etc/shellrc b/Base/etc/shellrc index f5e830b251..8ce254e7ee 100644 --- a/Base/etc/shellrc +++ b/Base/etc/shellrc @@ -40,3 +40,5 @@ if [ "$(id -u)" = "0" ] { export PROMPT="\\X\\u@\\h:\\w\\a\\e[$prompt_color;1m\\h\\e[0m:\\e[34;1m\\w\\e[0m \\p " export HISTORY_AUTOSAVE_TIME_MS=10000 + +PROGRAMS_ALLOWED_TO_MODIFY_DEFAULT_TERMIOS=(stty) diff --git a/Base/usr/share/man/man7/Shell-vars.md b/Base/usr/share/man/man7/Shell-vars.md index abe51b7344..976b09b97e 100644 --- a/Base/usr/share/man/man7/Shell-vars.md +++ b/Base/usr/share/man/man7/Shell-vars.md @@ -40,6 +40,15 @@ If `t` is not a non-negative integer, zero will be assumed. Note that multiple shell instances will not interfere with each other if they are to save to the same history file, instead, the entries will all be merged together chronologically. The default value for this option is set in `/etc/shellrc`. +3. Terminal settings + +`PROGRAMS_ALLOWED_TO_MODIFY_DEFAULT_TERMIOS` (local) + +The list value stored in this variable is used as an allow-list to filter programs that may modify the current terminal settings (i.e. default termios configuration) of the current shell session. +By default, this list includes `stty`, making it possible for the user to modify the terminal settings from within the shell. +Note that the shell will revert any termios changes if the running program is not in this list, or if it failed to run successfully (exited with an exit code other than zero). +Also note that the line editor will re-evaluate the keybindings and sync them when such a change occurs. + ## Visual 1. Prompting