MirBSD Weblog

Sponsored by
HostEurope Logo

MirBSD Weblog

⚠ This page contains old, outdated, obsolete, … historic or WIP content! No warranties e.g. for correctness!

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

mksh bug

2007-12-31 by bsiegert@

The problem from the last entry really seems to be a bug in ksh. In mksh, unsetting a non-existing variable gives a return value of 1. If set -e is active, then the script breaks at this point. This behaviour seems to be the same for the other ksh instances such as pdksh. From the mksh(1) manpage:

Unset the named parameters (-v, the default) or functions (-f). The exit status is non-zero if any of the parameters were already unset, zero otherwise.

However, SUSv3 clearly mandates that unset must return a zero exit state in this case. And it seems to be a sane thing actually: in any case, the result is the same afterwards, i.e. the variable is unset. I could care less if it was set before. Btw, both bash and tcsh return 0. zsh returns 1.

I think I will leave this here for tg@'s return. It will be up to him to decide.

Update (20.02.2008 tg@): Read this.

Oh well, today is december 31. Happy new year 2008, everyone!

MirBSD Logo