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