MirOS News

Sponsored by
HostEurope Logo

MirOS News

All 1 2 3 4 5 6 7 8 9 10 11 12

Countless users have requested we do the same as AT&T ksh93 and bow to the “be conservative in what you send, be liberal in what you accept” approach. Regarding to shell programming, this means we should support some of the most widely used extensions from other shells (ksh93, bash, zsh, csh, make(1)) as well.

Some hours of continuous cursing later, it's done. The current development version of mksh R30β now supports GNU bash style array initialisations – and better than they, I might add:

  • OpenBSD ksh (from OpenBSD 4.1-current, 17 May 2007):
    	$ x=(a b c)
    	/bin/ksh: syntax error: `(' unexpected
  • GNU bash (from MirPorts Framework, 2.05b-1):
    	$ v="d e"; x=('$a' "$v" c "(d)"); echo "${#x[*]}/${x[0]}/${x[1]}/${x[2]}/${x[3]}/"
    	4/$a/d e/c/(d)/
    	$ v="d e"; x=('$a' "$v" c (d)); echo "${#x[*]}/${x[0]}/${x[1]}/${x[2]}/${x[3]}/"
    	bash: syntax error near unexpected token `('
    	Segmentation fault
    	$ v="d e"; x=('$a' "$v" c "(d)"; echo "${#x[*]}/${x[0]}/${x[1]}/${x[2]}/${x[3]}/"
    	bash: syntax error near unexpected token `;'
    	Segmentation fault
    	$ bash -c 'v="d e"; x=('\''$a'\'' "$v" c "(d)"'
    	bash: -c: line 1: unexpected EOF while looking for matching `)'
    	Segmentation fault
    	$ bash -c 'v="d e"; x=('\''$a'\'' "$v" c "(d)"; echo "${#x[*]}/${x[0]}/${x[1]}/${x[2]}/${x[3]}/"'
    	bash: -c: line 1: syntax error near unexpected token `;'
    	bash: -c: line 1: `v="d e"; x=('$a' "$v" c "(d)"; echo "${#x[*]}/${x[0]}/${x[1]}/${x[2]}/${x[3]}/"'
    	Segmentation fault
  • mksh (-current as of tonight):
    	$ v="d e"; x=('$a' "$v" c "(d)"); echo "${#x[*]}/${x[0]}/${x[1]}/${x[2]}/${x[3]}/"
    	4/$a/d e/c/(d)/
    	$ v="d e"; x=('$a' "$v" c (d)); echo "${#x[*]}/${x[0]}/${x[1]}/${x[2]}/${x[3]}/"
    	mksh: syntax error: '(' unexpected
    	$ mksh -c 'v="d e"; x=('\''$a'\'' "$v" c "(d)"'
    	mksh: syntax error: ')' missing
    	$ mksh -c 'v="d e"; x=('\''$a'\'' "$v" c "(d)"; echo "${#x[*]}/${x[0]}/${x[1]}/${x[2]}/${x[3]}/"'
    	mksh: syntax error: ')' missing

As you can see, we're continuing our not only tradition but also mission to provide working, reliable software. (If you try interactively typing one of the last two examples, mksh just waits for the closing parenthesis.)

Furthermore, our portability promise is kept – mksh now also compiles fine with the vendor tools on HP-UX, which even have found a little shortcoming in the code I only can shake my head about… no idea who coded that ugly thing…

On unrelated news, bsiegert@ has continued his work on bringing the GNOME ports into shape for the impending release of MirOS #10.

MirOS Logo