Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
Last edited by jmgibson1981; 09-19-2022 at 07:48 PM.
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 3,058
Rep:
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.
/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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.