bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#1069978: bash: incorrect value of $BASH for login shells


From: Gioele Barabucci
Subject: Re: Bug#1069978: bash: incorrect value of $BASH for login shells
Date: Sun, 28 Apr 2024 21:07:18 +0200
User-agent: Mozilla Thunderbird

On 28/04/24 20:01, Chet Ramey wrote:
On 4/27/24 6:23 PM, Gioele Barabucci wrote:
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)

What does `su' pass to bash in argv[0]?


$ su $USER -s /bin/bash-static -c 'echo $BASH; readlink /proc/$$/exe; head -1z /proc/$$/cmdline; echo'
    /usr/bin/bash-static
    /usr/bin/bash-static
    bash-static

$ su -l $USER -s /bin/bash-static -c 'echo $BASH; readlink /proc/$$/exe; head -1z /proc/$$/cmdline; echo'
    /bin/bash
    /usr/bin/bash-static
    -bash-static

Regards,

--
Gioele Barabucci




reply via email to

[Prev in Thread] Current Thread [Next in Thread]