Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Tip: Try bosh as a fully POSIX compatible system shell!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6187

PostPosted: Tue Aug 02, 2016 6:24 pm    Post subject: Tip: Try bosh as a fully POSIX compatible system shell! Reply with quote

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:
  1. 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).
  2. 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.
  3. 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

  4. 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
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6263
Location: /usr/lib64/lv2

PostPosted: Wed Aug 03, 2016 9:15 pm    Post subject: Reply with quote

Nice. Following. 8)
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
schily
n00b
n00b


Joined: 20 Jul 2010
Posts: 2

PostPosted: Mon Aug 08, 2016 3:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
pun_guin
Apprentice
Apprentice


Joined: 06 Feb 2018
Posts: 165

PostPosted: Sat May 19, 2018 12:45 am    Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! Reply with quote

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
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6187

PostPosted: Sat May 19, 2018 6:15 am    Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! Reply with quote

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
View user's profile Send private message
Dr.Willy
Guru
Guru


Joined: 15 Jul 2007
Posts: 458
Location: NRW, Germany

PostPosted: Sat May 19, 2018 8:38 am    Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! Reply with quote

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
View user's profile Send private message
pun_guin
Apprentice
Apprentice


Joined: 06 Feb 2018
Posts: 165

PostPosted: Sat May 19, 2018 11:03 am    Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! Reply with quote

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
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3350

PostPosted: Sat May 19, 2018 12:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6187

PostPosted: Sat May 19, 2018 1:12 pm    Post subject: Re: Tip: Try bosh as a fully POSIX compatible system shell! Reply with quote

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
View user's profile Send private message
pun_guin
Apprentice
Apprentice


Joined: 06 Feb 2018
Posts: 165

PostPosted: Sat May 19, 2018 1:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6187

PostPosted: Sat May 19, 2018 1:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6187

PostPosted: Sat May 19, 2018 1:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
pun_guin
Apprentice
Apprentice


Joined: 06 Feb 2018
Posts: 165

PostPosted: Sat May 19, 2018 1:27 pm    Post subject: Reply with quote

eselect-sh literally asks for a POSIX shell though. That's a second bug then.
_________________
I already use the new Genthree.
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1699

PostPosted: Sat May 19, 2018 1:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum