View previous topic :: View next topic |
Author |
Message |
mv Watchman
Joined: 20 Apr 2005 Posts: 6780
|
Posted: Tue Aug 02, 2016 6:24 pm Post subject: Tip: Try bosh as a fully POSIX compatible system shell! |
|
|
Up to now, linux had no fully POSIX compatible system shell. ^1
This changed from today! ^2
bosh is a shell which aims for POSIX compatibility and speed, and it has full multicharacter support ^3
Like dash, also bosh has some features which go beyond POSIX and which appear necessary for proper programming (e.g. "local" or "test ... -nt ...").
In particular, it should run nicely as a system shell and might even speed up your boot process and ./configure runs!
If you are interested, install >=app-shells/schily-tools-2016.08.01-r1 from the mv overlay (available over layman) with SCHILYTOOLS=bosh (i.e. USE=schilytools_bosh) being set.
If you want to try it as a system shell make /bin/sh a symlink to bosh (or use app-select/eselect-sh) ^4
The upstream author is highly interested in your feedback (and in my experience he is very responsive).
You can use this thread for reporting.
Footnotes:
- For instance, bash, ksh, zsh - although they are good shells - do not even have the aim to be fully POSIX compatible.
Some old Bourne shells (e.g. heirloom-sh) do not obey modern POSIX standards at all.
dash strives for POSIX compatibility, but it currently fails due to lack of multicharacter support. Moreover, it accepts some code which should better not be accepted when you want to test for portable code (e.g. writing to non-opened streams).
- bosh passed a major praxis test today: As a system shell, it currently runs a highly shell-script-oriented system (including openrc, netifrc, openresolv, keychain, ...) without any issues.
- You can check whether your shell supports it by e.g.
Code: | printf '"%.4b"\n' löööööööööö | or Code: | IFS=ö; var=lölöl; echo $var |
If you want to use bosh as a system shell, it is currently strongly recommended to emerge app-shells/schily-tools with USE=posix being set, for otherwise it might happen in some cases that bosh does not start in posix mode. |
|
Back to top |
|
|
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6656 Location: The soundosphere
|
|
Back to top |
|
|
schily n00b
Joined: 20 Jul 2010 Posts: 2
|
Posted: Mon Aug 08, 2016 3:45 pm Post subject: |
|
|
I am not sure whether this is obvious from reading the original article, but the shell in question is based on the original Bourne Shell sources.
So the new code is based on 40 year old mature code and has been enhanced to support the POSIX shell features.
Even though the code is still not huge, the current source code is 4x the size of the Svr4 Bourne Shell from 1989. |
|
Back to top |
|
|
pun_guin Apprentice
Joined: 06 Feb 2018 Posts: 204
|
Posted: Sat May 19, 2018 12:45 am Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! |
|
|
I installed schily-tools from the slightly more up-to-date spikyatlinux overlay. The bosh command works. However, I cannot set it as "the default shell" - eselect sh list only ever finds the bash.
Has this functionality been removed? _________________ I already use the new Genthree. |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6780
|
Posted: Sat May 19, 2018 6:15 am Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! |
|
|
pun_guin wrote: | I installed schily-tools from the slightly more up-to-date spikyatlinux overlay. |
I don't know that overlay, but I am wondering why you think that the mv overlay is not up-to-date concerning schily-tools: Usually updates of schily-tools are bumped very soon after their release (sometimes a few hours later, sometimes it takes a few days, but rarely more than a week).
Quote: | eselect sh list only ever finds the bash |
app-eselect/eselect-sh is very poor: It has only a fixed hardcoded list of shells. All it does is to create the /bin/sh symlink. |
|
Back to top |
|
|
Dr.Willy Guru
Joined: 15 Jul 2007 Posts: 547 Location: NRW, Germany
|
Posted: Sat May 19, 2018 8:38 am Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! |
|
|
mv wrote: | app-eselect/eselect-sh is very poor: It has only a fixed hardcoded list of shells. All it does is to create the /bin/sh symlink. |
How else would you do it, but with a hardcoded list? In theory you could use a category, but app-shells is too generic.
ceterum censeo categories suck |
|
Back to top |
|
|
pun_guin Apprentice
Joined: 06 Feb 2018 Posts: 204
|
Posted: Sat May 19, 2018 11:03 am Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! |
|
|
mv wrote: | I am wondering why you think that the mv overlay is not up-to-date |
It seems that the other repositories has larger version numbers, unless I looked in the wrong place.
mv wrote: | app-eselect/eselect-sh is very poor: It has only a fixed hardcoded list of shells. |
It was suggested to be used in the original posting. Maybe someone should fix it? _________________ I already use the new Genthree. |
|
Back to top |
|
|
depontius Advocate
Joined: 05 May 2004 Posts: 3522
|
Posted: Sat May 19, 2018 12:15 pm Post subject: |
|
|
When I switched "/bin/sh -> /bin/dash" it was because I'd read that dash was faster/leaner because it was a scripting shell, not having extra command-line functionality. My sessions still use /bin/bash as the command shell.
It sounds like /bin/bosh might be as much command-line shell as it is a scripting shell. Can you comment on functionality / speed trade-offs? _________________ .sigs waste space and bandwidth |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6780
|
Posted: Sat May 19, 2018 1:12 pm Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! |
|
|
Dr.Willy wrote: | How else would you do it, but with a hardcoded list? |
Most distributions have a file in /etc for it. Edit: Also gentoo has this file: /etc/shells.
I expected that eselect-sh would use it, but I had never emerged this package before the question came up now. |
|
Back to top |
|
|
pun_guin Apprentice
Joined: 06 Feb 2018 Posts: 204
|
Posted: Sat May 19, 2018 1:17 pm Post subject: |
|
|
IMO, using /etc/shells will not make sense here since they don't necessarily have to be POSIX shells. _________________ I already use the new Genthree. |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6780
|
Posted: Sat May 19, 2018 1:19 pm Post subject: |
|
|
depontius wrote: | It sounds like /bin/bosh might be as much command-line shell as it is a scripting shell. |
IMHO the only shell with really strong interactive features is zsh.
bosh does not have much features concerning the command line.
Quote: | Can you comment on functionality / speed trade-offs? |
I think speed is comparable to dash. Some string functions are a bit slower, because full locale support (as required by posix) simply costs more time than pure 8-bit handling which dash does. |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6780
|
Posted: Sat May 19, 2018 1:23 pm Post subject: |
|
|
pun_guin wrote: | IMO, using /etc/shells will not make sense here since they don't necessarily have to be POSIX shells. |
It is not a POSIX requirement that /bin/sh is a POSIX shell. And as already pointed out, none of the hardcoded shells in eselect-sh is POSIX, either. |
|
Back to top |
|
|
pun_guin Apprentice
Joined: 06 Feb 2018 Posts: 204
|
Posted: Sat May 19, 2018 1:27 pm Post subject: |
|
|
eselect-sh literally asks for a POSIX shell though. That's a second bug then. _________________ I already use the new Genthree. |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3467
|
Posted: Sat May 19, 2018 1:55 pm Post subject: |
|
|
pun_guin wrote: | eselect-sh literally asks for a POSIX shell though. That's a second bug then. |
POSIX shell or POSIX-compatible shell?
A script written with posix in mind will run just fine in any compatible shell. A script written for a compatible shell may or may not run in pure posix shell. |
|
Back to top |
|
|
|