Set BASHRC_FORWARD variable and remove BASH_COMPLETION_VERSINFO workaround because I fixed it in nix

This commit is contained in:
cubernetes 2026-10-16 12:25:41 +02:00
parent 728a5f14b5
commit e99f461ce3

View file

@ -8,9 +8,8 @@ bashrc_get () {
#-# Has some bugs, which is why we have to introduce this bashrc_get and that bashrc_load function, instead #-# Has some bugs, which is why we have to introduce this bashrc_get and that bashrc_load function, instead
#-# of just embedding it inside the command substitution. #-# of just embedding it inside the command substitution.
echo "set -v" echo "set -v"
#-# Setting BASH_COMPLETION_VERSINFO because nixos likes to hijack your .bashrc to run bash-completion.sh, which #-# Marker and variable so we can slice out the original .bashrc for relaying and have custom login only for forwarded .bashrc
#-# of course fails on remote systems, so we need a way to stop that from happening. Not perfect, but I'll accept the tradeoff. echo "BASHRC_FORWARDED=1"
echo "[ \"\${BASH_COMPLETION_VERSINFO-}\" ] || BASH_COMPLETION_VERSINFO="
#-# There's still a bug in bash at the moment regarding verbose mode not being turned on again after ${ :;} #-# There's still a bug in bash at the moment regarding verbose mode not being turned on again after ${ :;}
#-# https://www.mail-archive.com/bug-bash@gnu.org/msg35966.html #-# https://www.mail-archive.com/bug-bash@gnu.org/msg35966.html
#-# Therefore, be careful to use this new command substition syntax until it is fixed upstream! #-# Therefore, be careful to use this new command substition syntax until it is fixed upstream!
@ -21,7 +20,7 @@ bashrc_get () {
bashrc_load () { bashrc_load () {
if [ "$_s" ]; then if [ "$_s" ]; then
#-# Relay .bashrc if it has already been forwarded #-# Relay .bashrc if it has already been forwarded
: "${_s#*[B]ASH_COMPLETION_VERSINFO=[[:space:]]}" : "${_s#*[B]ASHRC_FORWARDED=1[[:space:]]}"
printf %s "${_%[[:space:]][s]et +v*}" printf %s "${_%[[:space:]][s]et +v*}"
else else
#-# Warning: Your `.bashrc` MUST NOT print any error messages at all! #-# Warning: Your `.bashrc` MUST NOT print any error messages at all!