should have compile-time options to disable mksh builtins

Bug #1616693 reported by Elliott Hughes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mksh
Invalid
Undecided
Unassigned

Bug Description

builtins such as cat, echo, kill, pwd, realpath, ulimit, and sleep often have better implementations available on the platform.

some builtins (printf, say) do have compile-time options to disable them, but the ones listed above don't. it would be nice to have an "official" way to disable these rather than maintain a local patch.

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

There is no “printf” builtin in mksh. It can be added as a speed hack, but this is discouraged, and the user has to provide the code (printf.c) themselves, although it can be taken from MirBSD.
Similarily, making “echo” external will slow down things. (Do note that mksh has no less than three “echo” implementations and, when called as “mksh” (not in sh or posix mode), offers the best one.)

“better” is relative. But let’s not argue this particular point.

I fail to see how you can make “killÌ” or “sleep” better… mksh’s offers 100% of the functionality commonly found (including sub-second sleep).

“pwd” and “ulimit” must be builtins.

We already defer to external utilities for both “cat” and (new in R53) “realpath” if called with an option, any option. (The “cat” builtin does, however, support the POSIX ‘-u’ flag.)

Please see the dot.mkshrc file shipped with the distribution for an implementation of the “enable” utility from GNU bash, which can be used to enable/disable using the built-in utilities or external ones. (The builtin is still available via “\builtin cat”, etc.) but take my advice to be careful with this — users don’t normally need, nor do, this.
After all, one of the strengths of mksh is that it behaves consistent across platforms.

Changed in mksh:
status: New → Invalid
Revision history for this message
Elliott Hughes (enh-9) wrote :

> I fail to see how you can make “killÌ” or “sleep” better… mksh’s offers 100% of the functionality commonly found (including sub-second sleep).

people notice behavioral differences between the two. even if it's just whether --help works. and that leads to bug reports.

> Please see the dot.mkshrc file shipped with the distribution for an implementation of the “enable” utility from GNU bash, which can be used to enable/disable using the built-in utilities or external ones.

that sounds interesting, but one of the other problems we have is that unlike other shells, mksh doesn't let us have an rc file that's read for interactive and non-interactive sessions. so anything in our mkshrc becomes another difference that confuses users.

> After all, one of the strengths of mksh is that it behaves consistent across platforms.

maybe so, but most of the bug reports i see are that it's not consistent on a single platform :-)

Revision history for this message
Thorsten Glaser (mirabilos) wrote : Re: [Bug 1616693] Re: should have compile-time options to disable mksh builtins

Elliott Hughes dixit:

>people notice behavioral differences between the two. even if it's just
>whether --help works. and that leads to bug reports.

Well, --help is a GNUism… didn’t you work for Android last time
I looked? ;-) So no tool there should have that.

bye,
//mirabilos
--
>> Why don't you use JavaScript? I also don't like enabling JavaScript in
> Because I use lynx as browser.
+1
 -- Octavio Alvarez, me and ⡍⠁⠗⠊⠕ (Mario Lang) on debian-devel

Revision history for this message
Elliott Hughes (enh-9) wrote :

Android uses toybox for /system/bin so everything has --help. but for sleep the bug report was that /system/bin/sleep supports the suffixes (such as "2m") but the built-in sleep doesn't.

i'll disable cat and sleep locally to match bash, since people who have expectations probably have them from there.

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

Elliott Hughes dixit:

>i'll disable cat and sleep locally to match bash, since people who have
>expectations probably have them from there.

As long as you do *not* break “builtin cat”, *and* as long as you
patch KSH_VERSION, similar to how Debian wheezy did, and to how
PLD Linux does, to mark it as differing from official mksh, you’re
of course free to do that.

bye,
//mirabilos
--
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence. -- Coywolf Qi Hunt

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.