Slackware ash bug
When using 'ash-0.4.0-x86_64-2' included in Slackware current to test compatibilty with scripts I discovered the following issue.
Consider this example. Code:
#!/bin/ash Code:
word = test - オウムのジャングル Code:
word = test - オウムのジャングル The frustrating part is that other ash implementations do not have this problem including the busybox and freebsd ash nor do related shells like dash or yash. For bonus, consider this more advanced usage which will result in an infinite loop with the Slackware ash... Code:
#!/bin/ash |
I am not sure that the Slackware installer and/or the (generated) initrd are supposed to support Japanese or any Asian languages...
Long story short, I thought that the ASH is a mini-shell, limited like hell. PS. In fact, it is (still) used (the ASH) in the installer? |
I am not testing the installer, I use it because I am interested in writing portable scripts that work anywhere. Other ash implementations do not have this problem either...
|
Yes, the Slackware version of ash is severely limited, and there are no longer any scripts in Slackware (in the installer or elsewhere) that use it. Since it seems that dash is the designated successor to ash on Linux systems, perhaps the solution is to switch to that?
|
Dash would work, but another possible idea is to simply change to a different ash implementation which is not quite as limited. The ash in busybox or freebsd seem better maintained for example. I understand the Slackware ash was derived from a netbsd version, but I am not sure what status their current sh is in? Although it may not be your direct concern I wonder how far spread this particular ash is beyond just Slackware?
|
I don't think that ash be able to process UTF-8 encoded files.
ash-0.40 shipped in Slackware-current is more that 16 years old... While there has been a proposal for processing UTF-8 in a shell in 1992, I don't think there have been many implementations before 2003. @Orbea: to test compatibility (assuming that you want that your script be portable, i.e. doesn't need any extension beyond what is specified by POSIX), you could use dash (available from SBo) or just bash in POSIX mode (bash --posix). @Darth Vader: the Slackware installer uses bash and I don't think it can work as-is with another shell. PS Sorry, I typed too slow... And anyway all ash implementations are very limited and I don't think any be POSIX compliant. So yes, if it is to be replaced in Slackware dash looks like a good candidate. |
Didier, thanks for details, my French friend! :D
@orbea I think you make a dramatic huge confusion, because looks like today, the shell so called ASH is basically a modular Bash framework: https://github.com/ash-shell/ash Read: something like a Bash on steroids. So, looks like the modern ASH is NOT the same with our 16 years old junk... ;) PS. I wonder, why we do not send in retirement this really old pal, if it is not used anymore? |
I find the easiest way to test compatibility is to actually try the shells, using dash or bash --posix doesn't teach things like how in ksh 'type' is an alias to 'whence -v' nor will it reveal silent exits in a more limited shell where you left undefined behavior. :)
Anyways, my main intent was to record this somewhere public and given that this seems to be specific to the ash used by Slackware this seemed to be the best place. |
@Darth Vader: You should realize your link has nothing to do with the Almquist Shell (Ash) despite the misleading name.
https://en.wikipedia.org/wiki/Almquist_shell https://github.com/ash-shell/ash/issues/41 |
Thanks, I figured out already... ;)
Also, looks like today the old ASH is called for real DASH: http://gondor.apana.org.au/~herbert/dash/ Latest source being: http://gondor.apana.org.au/~herbert/...h-0.5.9.tar.gz (2016-06-06) So, I suspect that the other distros use this DASH, eventually symlinked as /bin/ash ... |
I found a way to work around this issue, but it will still get that one kana wrong... I guess its truly hopeless with this old shell. :)
To get the first letter. Code:
#!/bin/ash Code:
#!/bin/ash Code:
word = test - オウムのジャングル |
@orbea
BUT, the question is: is not BASH present in any honorable distribution? Make sense for you to insist on mini-shells? |
Can you please go be rude somewhere else? This thread has nothing to do with bash nor have you left a single useful reply.
|
Actually there is a work around, considering that the Slackware ash does not have printf as a builtin and that it falls back to the GNU printf in coreutils which does not have this bug this can be done.
Code:
#!/bin/ash Code:
#!/bin/ash |
Quote:
The last time someone checked, you can knock a measurable amount of time off of boot startup by using dash in the Slackware init scripts versus bash. |
All times are GMT -5. The time now is 03:07 AM. |