diff --git a/recipes/shells/bash/etc/bash.bashrc b/recipes/shells/bash/etc/bash.bashrc index 0f84bea4dc..2e2b197bdd 100644 --- a/recipes/shells/bash/etc/bash.bashrc +++ b/recipes/shells/bash/etc/bash.bashrc @@ -11,8 +11,11 @@ shopt -s checkwinsize # TODO: redox_chroot +# Read the file with the `read` builtin instead of `$(cat ...)`: a command +# substitution here fork/execs a subprocess, and a spawn during interactive +# shell startup can stall the shell on the live image before its first prompt. if [ -z "${redox_chroot:-}" ] && [ -r /etc/redox_chroot ]; then - redox_chroot=$(cat /etc/redox_chroot) + read -r redox_chroot < /etc/redox_chroot 2>/dev/null || redox_chroot= fi # set a fancy prompt (non-color, overwrite the one in /etc/profile) diff --git a/recipes/shells/bash/etc/profile b/recipes/shells/bash/etc/profile index 7f85066c60..3b36091d61 100644 --- a/recipes/shells/bash/etc/profile +++ b/recipes/shells/bash/etc/profile @@ -9,7 +9,12 @@ if [ "${PS1-}" ]; then . /etc/bash.bashrc fi else - if [ "$(id -u)" -eq 0 ]; then + # Do NOT spawn a subprocess here (the old `$(id -u)` command substitution). + # A login shell sources this file before drawing its first prompt; on Redox + # a process spawn during that window can stall, hanging the shell before it + # is ever usable. Use the shell/login-provided EUID or USER instead — both + # are set by login(1) — so this stays a pure builtin test with no fork/exec. + if [ "${EUID-}" = 0 ] || [ "${USER-}" = root ] || [ "${LOGNAME-}" = root ]; then PS1='# ' else PS1='$ ' diff --git a/recipes/shells/bash/etc/skel/.bashrc b/recipes/shells/bash/etc/skel/.bashrc index 437837411a..5837c1ace2 100644 --- a/recipes/shells/bash/etc/skel/.bashrc +++ b/recipes/shells/bash/etc/skel/.bashrc @@ -26,7 +26,9 @@ shopt -s checkwinsize #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" +# lesspipe disabled: `$(lesspipe)` spawns a subprocess during shell startup, +# which can stall the shell on the live image before its first prompt. +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in @@ -58,7 +60,9 @@ unset color_prompt force_color_prompt # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + # dircolors disabled: `$(dircolors -b)` spawns a subprocess during shell + # startup, which can stall the shell on the live image before its prompt. + # test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto'