On 2013-12-18 16:48:46 +0000, Thorsten Glaser wrote:
> Vincent Lefevre dixit:
> >mksh intends to behave like ksh93.
>
> No. mksh only takes AT&T ksh93 behaviour as primary rule of
> thumb. In fact, you will find that ksh93 behaves unlike all
> other modern shells in many ways, such as scoping.
>
> Ib> mksh, which means mkshb> language of its own that also happens to be 
> largely POSIX
> sh compatible and leaning on AT&T ksh, but also GNU bash
> and zsh.

Well, that's very confusing, because both ksh93 and mksh are
ksh alternatives. This can break scripts with "#!/bin/ksh".

ypig:~> update-alternatives --display ksh
ksh - auto mode
  link currently points to /bin/ksh93
/bin/ksh93 - priority 20
  slave ksh.1.gz: /usr/share/man/man1/ksh93.1.gz
  slave usr.bin.ksh: /bin/ksh93
/bin/mksh - priority 12
  slave ksh.1.gz: /usr/share/man/man1/mksh.1.gz
  slave usr.bin.ksh: /bin/mksh
/bin/mksh-static - priority 11
  slave ksh.1.gz: /usr/share/man/man1/mksh.1.gz
  slave usr.bin.ksh: /bin/mksh-static
Current 'best' version is '/bin/ksh93'.

The mksh and mksh-static alternatives should be dropped.

[...]
> tg@freewrt:~ $ mksh -c 'echo $((010))'
> 10
> tg@freewrt:~ $ lksh -c 'echo $((010))'
> 10
> tg@freewrt:~ $ mksh -o posix -c 'echo $((010))'
> 8
> tg@freewrt:~ $ lksh -o posix -c 'echo $((010))'
> 8
>
> >Shell: /bin/sh linked to /bin/dash
>
> See /usr/share/doc/mksh/NEWS.Debian.gz for mksh (46-2), too.
> Note that lksh in Debian, when called as sh, enables the POSIX
> mode automatically:
[...]

But I assume that this is not the case of mksh. The mksh man page
contains:

    -o posix
          Enable a somewhat more POSIXish mode.  As a side effect,
          setting this flag turns off braceexpand mode, which can
          be turned back on manually, and sh mode.

    -o sh
          Enable /bin/sh (kludge) mode.  Automatically enabled if
          the basename of the shell invocation begins with b          and this 
autodetection feature is compiled in (not in
          MirBSD).  As a side effect, setting this flag turns off
          braceexpand mode, which can be turned back on manually,
          and posix mode.

And with "-o sh", it doesn't follow POSIX here:

ypig:~> mksh -o sh -c 'echo $((010))'
10

So, the package description should be fixed. It currently says:

 This shell is Debian Policy 10.4 compliant and may be used as /bin/sh
 on Debian systems (if udev is installed, /bin/lksh should be used;
 otherwise, both /bin/mksh-static and /bin/mksh flavours also work),
 and as rescue and initrd shell (/bin/mksh-static especially).
 .
 The mksh-static binary is a version of mksh, linked against klibc or
 dietlibc (if they exist for that Debian architecture and are usable)
 and optimised for small code size, for example for use on initrd or
 initramfs images, installation or rescue systems, or /bin/sh on slow
 architectures.

--
Vincent LefC(vre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org


Reply via email to