LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Void sh points to dash yet LFS wants bash (https://www.linuxquestions.org/questions/linux-from-scratch-13/void-sh-points-to-dash-yet-lfs-wants-bash-4175716924/)

jr_bob_dobbs 09-19-2022 06:10 PM

Void sh points to dash yet LFS wants bash
 
Thinking of building an LFS system again.

I'm currently running Void Linux. /bin/sh is a sym link to dash. LFS book says it should be a sym link to bash.

Bash is installed in my system but I wonder if bash's emulation of sh is the same as dash's. Will anything in Void break if I change the sym link to point to bash? If I leave the sym link, will anything break in the LFS scripts and/or commands?

Thank you.

jmgibson1981 09-19-2022 07:47 PM

Most likely not. Worst case bash should be installed, just create a temp symlink to it and use the new symlink to open the shell as you work on your lfs. Is what I would do anyway. You can also enter a bash shell by typing bash in the shell. it will go to a subshell of sorts that is bash... at least as long as bash isn't also symlinked to dash.

hazel 09-20-2022 04:17 AM

istr there are some "bashisms" in LFS builds that won't work if dash is the system shell. At least that used to be the case.

Keith Hedger 09-20-2022 05:05 AM

Its not so much that LFS uses so called 'bashisms' ( in fact I think they dont ) but some build systems use a hard coded BASH, just symlink sh->/bin/bash it wont hurt, you can always put it back later.

boughtonp 09-20-2022 06:00 AM

Quote:

Originally Posted by jr_bob_dobbs (Post 6381267)
/bin/sh is a sym link to dash. LFS book says it should be a sym link to bash.

More precisely, LFS Host Requirements says:
Quote:

Originally Posted by https://www.linuxfromscratch.org/lfs/view/stable/chapter02/hostreqs.html
Bash-3.2 (/bin/sh should be a symbolic or hard link to bash)

...

Note that the symlinks mentioned above are required to build an LFS system using the instructions contained within this book. Symlinks that point to other software (such as dash, mawk, etc.) may work, but are not tested or supported by the LFS development team, and may require either deviation from the instructions or additional patches to some packages.


However, Bash says:
Quote:

Originally Posted by https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html
Starting Bash with the --posix command-line option or executing ‘set -o posix’ while Bash is running will cause Bash to conform more closely to the POSIX standard by changing the behavior to match that specified by POSIX in areas where the Bash default differs.

When invoked as sh, Bash enters POSIX mode after reading the startup files.

The posix option includes the clarification: "This is intended to make Bash behave as a strict superset of that standard."

So as a superset it is still possible that invoking Bash as /bin/sh has Bash-specific behaviour in areas which POSIX has not defined, but that would be bad practice and unnecessary since anything needing Bash behaviour can easily just use /bin/bash instead.

If LFS does do use Bash-specific behaviour via /bin/sh, manually updating any commands/scripts to use "/bin/bash --posix" instead of "/bin/sh" should work, without needing to swap the /bin/sh symlink, (even if that might be a simpler option).



All times are GMT -5. The time now is 05:48 PM.