From 6fa2184da5b18ef90d35bd1db41f870f5bae44a3 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 12 Jan 2021 02:28:54 +0100 Subject: [PATCH] profile.d: Prevent setting VTE-specific PROMPT_COMMAND without VTE Fedora's /etc/bashrc sets the PROMPT_COMMAND environment variable to __vte_prompt_command when running inside a VteTerminal. This becomes a problem if the __vte_prompt_command shell function is missing because /etc/profile.d/vte.sh itself is absent [1], which is the case with the Red Hat Universal Base Image. This tricks the code in /etc/bashrc into not doing that. [1] https://pagure.io/setup/pull-request/23 https://github.com/containers/toolbox/pull/667 --- profile.d/toolbox.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/profile.d/toolbox.sh b/profile.d/toolbox.sh index b68014c..d43f6c7 100644 --- a/profile.d/toolbox.sh +++ b/profile.d/toolbox.sh @@ -55,6 +55,14 @@ if [ -f /run/.containerenv ] \ touch "$toolbox_welcome_stub" fi + if ! [ -f /etc/profile.d/vte.sh ] && [ -z "$PROMPT_COMMAND" ] && [ "${VTE_VERSION:-0}" -ge 3405 ]; then + case "$TERM" in + xterm*|vte*) + [ -n "${BASH_VERSION:-}" ] && PROMPT_COMMAND=" " + ;; + esac + fi + if [ "$TERM" != "" ]; then error_message="Error: terminfo entry not found for $TERM" term_without_first_character="${TERM#?}"