Re: The Case for Rust (in the base system)

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Mon, 05 Aug 2024 22:06:43 UTC
--------
Warner Losh writes:

> > > Most user space tools could be written in lua.
> >
> > That /exact/ same argument was made for Perl :-)
>
> Lua's been in the base since I imported it for the boot loader, though...

Lua is is much more "language" than "eco-system", by design as I
understand it, so that is a different situation than Perl or Rust.

I personally do not subscribe to to the "let's rewrite all the 50
year old source code to make it more safe" philosophy, but there
are valid arguments when the old code is horrible.

But there are some wrinkles.

First: Anything setuid/setgid is off-limits.

There are good reasons why we dont have setuid shell-scripts (any more!)

I guess with most systems being effectively single-user these days,
that may not be as much a security focus as it was back in the 1990ies.

Second: Performance.

I cannot remember the exact subset of bin programs somebody did in
Perl as proof of concept, but it slowed down buildworld a LOT to
fire up all of Perl to do trivial stuff like "echo", "chown" and
"mkdir".

Lua may be cheaper than Perl, but it will still be measurable.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.