Finn Thain dixit:

>That would produce the result that I had expected, which was the result
>that bash produced. Does your mksh give a different result than the result
>I posted from my mksh build?

Ah, sorry, I was mistaken: that’s what mksh does *except* for
POSIX special builtins. And that’s what POSIX mandates.

┌──┤ 
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_14
│   2. Variable assignments specified with special built-in utilities
│      remain  in  effect after the built-in completes; this shall not
│      be the case with a regular built-in or other utility.
└───

So just add the “except” everywhere I forgot it. (I’m apparently prone
to inverse-logic errors; these are, by far, the most frequent ones I
see me doing/repeating. Especially when tired; this week was hard.)

>"exec $special_builtin_command" generates an error in bash, but not in
>mksh, as in the examples I posted. The question was, what does POSIX say
>about it.

Ah. POSIX doesn’t say anything about builtins, it only references
“command”s here. In mksh, you can “exec” builtins, and, in mksh,
“exec” never returns, even if the command to run was not found,
unlike GNU bash. This is also in accordance with POSIX:

┌──┤ 
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#exec
│    If  [267]exec  is  specified  with command, it shall replace the
│    shell  with command without creating a new process. If arguments
┊ […]
│    If  command  is  specified,  [268]exec  shall  not return to the
│    shell;  rather, the exit status of the process shall be the exit
│    status  of  the program implementing command, which overlaid the
│    shell. If command is not found, the exit status shall be 127. If
│    command  is found, but it is not an executable utility, the exit
│    status  shall  be  126.  If  a  redirection  error  occurs  (see
└───

>> Sure, I'll prod bonsaikitten later. Does Gentoo have a recent (2.x)
>> klibc packaged including the "klcc" compiler wrapper?
>
>Yes.

OK, good.

># find /var/tmp/portage/dev-libs/klibc-2.0.2/image -name klcc
>/var/tmp/portage/dev-libs/klibc-2.0.2/image/usr/bin/klcc

That means that klcc will end up in /usr/bin/ once installed,
right?

>As well as "static", Gentoo ebuilds sometimes implement a "minimal" USE
>flag that may generate packages with some features (or bloat) omitted.

While one certainly could do that with mksh, e.g. -DMKSH_SMALL,
I don’t quite see the point if the “minimal” USE flag is described
to omit “bloat” ;-)

Things like -DMKSH_SMALL are intended only for initramfs /bin/sh
or embedded devices with only 4 MiB flash or something. The stuff
that’s omitted is not just bloat but also quite some features.

(Note that mksh compiled against klibc will omit the ability to
get/set ulimits, because klibc lacks the support functions to do
so; other than that, I think, it’s full-featured.)

bye,
//mirabilos
-- 
> Hi, does anyone sell openbsd stickers by themselves and not packaged
> with other products?
No, the only way I've seen them sold is for $40 with a free OpenBSD CD.
        -- Haroon Khalid and Steve Shockley in gmane.os.openbsd.misc

Reply via email to