bug-bash
[Top][All Lists]
Advanced

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

bash login shell detection broken using default compile options


From: Tycho Kirchner
Subject: bash login shell detection broken using default compile options
Date: Thu, 16 Mar 2023 17:21:23 +0100

Hi,
when compiling bash with a plain

mkdir build; cd build; ../configure && make

the login shell detection (leading dash: -bash) is apparently broken - at 
least, ~/.bashrc is not sourced.
This happens in all tested versions, from 4.4 until the latest release 5.2.15.
Interestingly, using distribution provided binaries, everything is fine (tested 
on Debian Bullseye, Debian testing and OpenSuse Leap).

Steps to reproduce:

Compile bash from source using default compile options (see above).

Put

echo hi from bashrc >&2

to the beginning of your ~/.bashrc.

Create the following python script and make it executable:

~/test.py
__________________________________________
#!/usr/bin/env python3
import os
import sys
bash_path=sys.argv[1]
os.execv(bash_path, ['-bash', 'foobar',])
__________________________________________

Run the script with the distribution provided binary:

$ ~/test.py /bin/bash
hi from bashrc
-bash: foobar: No such file or directory

Run the script with your own compiled binary:

$ ~/test.py ~/tmp/bash/bash-5.2.15/build/bash
-bash: foobar: No such file or directory

--> ~/.bashrc was apparently not sourced.

Thanks
Tycho




reply via email to

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