[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug#1069978: bash: incorrect value of $BASH for login shells
From: |
Gioele Barabucci |
Subject: |
Bug#1069978: bash: incorrect value of $BASH for login shells |
Date: |
Sun, 28 Apr 2024 00:23:35 +0200 |
User-agent: |
Mozilla Thunderbird |
Package: bash
Version: 5.2.21-2
X-Debbugs-CC: bug-bash@gnu.org
Hi,
bash 5.0 and 5.2 do not set $BASH to the right value when bash is used
as the login shell:
$ apt install bash-static
$ getent passwd $USER | cut -d: -f 7
/bin/bash
$ su $USER -s /bin/bash-static -c 'echo $BASH; readlink
/proc/$$/exe; true'
/usr/bin/bash-static
/usr/bin/bash-static
$ su -l $USER -s /bin/bash-static -c 'echo $BASH; readlink
/proc/$$/exe; true'
/bin/bash
/usr/bin/bash-static
(bash-static is not a link to bash)
Bash also uses the value in /etc/passwd when in login mode, although the
documentation says
> BASH Expands to the full filename used to invoke this instance of bash.
"full filename" could be interpreted both as "an absolute filename" as
well as "the canonical absolute path".
$ su $USER -s /bin/bash -c 'echo $BASH; readlink /proc/$$/exe; true'
/usr/bin/bash
/usr/bin/bash
$ su -l $USER -s /bin/bash -c 'echo $BASH; readlink /proc/$$/exe; true'
/bin/bash
/usr/bin/bash
Regards,
--
Gioele Barabucci
- Bug#1069978: bash: incorrect value of $BASH for login shells,
Gioele Barabucci <=