Subject: [alpine-devel] RFC: Introducing tools-base meta package

From: Przemysław Pawełczyk <[email-masked]>
Date: Mon, 12 Feb 2018 10:19:32 +0100

Hi, Alpiners!

What would you say about introducing new meta packages:

- tools-base - depending on busybox for now,
- tools-base-initscripts - depending on busybox-initscripts for now?

After introducing they could replace busybox and busybox-initscripts as
dependencies of alpine-base.

(Maybe provides="/bin/sh" should be moved from busybox to tools-base
then, not sure yet.)

It will greatly ease possible future changes like replacing busybox or
parts of it, even if such changes won't be happening soon, i.e. before
releasing Alpine Linux 3.8.

---

Mind that this RFC is not about replacing busybox, but about introducing
changes that would make such endeavour more pain-free if ever happening.
But let me very briefly go into that territory too.

Why replace busybox?
To have better implementation of widely used tools, of course.

Any candidates?
2 examples come to my mind right now.

- toybox

It "combines common Linux command line utilities together into a single
BSD-licensed executable that's simple, small, fast, reasonably
standards-compliant".

It's not as complete as busybox, so no drop-in replacement yet,
but it has many toys already available:
http://landley.net/toybox/status.html

Replacing busybox partially would require reorganizing its package,
and most likely switching from trigger-based symlinks to explicit ones
provided by some subpackages.

- mawk

It's "an interpreter for the AWK Programming Language".
It will possibly allow to make some packages depend on it instead of
gawk.

I believe A. Wilcox can share details why it's better than busybox's
awk, after dealing with it in Adelie Linux.

Regards,
Przemek

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Cág <[email-masked]>
Date: Mon, 12 Feb 2018 13:26:22 +0000

> To have better implementation of widely used tools, of course.

I threw away busybox and other "core/base" packages (they are, as a
matter of fact, present because of dependencies but are dummy and
contain nothing) and replaced them with:

sbase    - portable Unix utilities (cat, du, ls etc.);
ubase    - unportable Linux utilities (mount, ps, dd etc.);
sinit    - a simple init;
svc      - service management (init scripts were brought from stali and
	Morpheus);
vis      - a text editor (sbase has a very ed implementation);
mksh     - a shell;
nawk     - the One True Awk;
pigz     - for gzip
iproute2 - for various net utilities;
sdhcp    - a small DHCP client;
curses   - NetBSD curses.

What's missing (stty, patch, diff etc.) can be pulled from BSDs or
Heirloom.

With this on top of the "real" Alpine core (musl/apk-tools etc.) you
have a complete distribution.

Also, what can be statically linked should be statically linked.

Now, we need a decent file system layout, throw away all GNU
dependencies, link everything statically (, write our own kernel, reach
Mars before Elon Musk...)

--
caóc

---

---

From: "A. Wilcox" <[email-masked]>
Date: Mon, 12 Feb 2018 11:28:22 -0600

> sbase    - portable Unix utilities (cat, du, ls etc.);

I am vaguely interested in this.  Does it implement POSIX options?

> ubase    - unportable Linux utilities (mount, ps, dd etc.);

Does this integrate with other service managers (like OpenRC, s6) or
does it only work with svc?  Do you have a link?

> vis      - a text editor (sbase has a very ed implementation);

I probably would have gone with dash or pksh, but mksh isn't terrible.
Its ideas of built-ins is definitely unique.  I use this on my 486.

> sdhcp    - a small DHCP client;

Haven't heard of this one, is it from the same people as sbase?

> curses   - NetBSD curses.

Have you looked in to pdcurses?  How does it compare?

> What's missing (stty, patch, diff etc.) can be pulled from BSDs or

Adélie ships heirloom-devtools if you want Real Unix make, m4, lex,
yacc, etc in APK format :)

Best,
--arw

-- 
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org

---

From: "Laurent Bercot" <[email-masked]>
Date: Mon, 12 Feb 2018 17:57:40 +0000

>does it only work with svc?  Do you have a link?

  Most of the relevant suckless stuff can be found at
https://core.suckless.org/ - and that includes sdhcp. I haven't tested
many of their programs, but I have looked at sbase+ubase, and
it's clean. Cleaner than busybox; I still need to compare it to
toybox.

  sinit just forks a one-time init script at boot time and then
enters its reaping loop. So it will integrate with any service
manager you want.
  However, it's not a correct init, because it doesn't supervise
anything, so kill -9 -1 will brick the machine. (This is the same
problem that dalias' init has.) For this reason, I do not recommend it.

--
  Laurent

---

---

From: Cág <[email-masked]>
Date: Wed, 14 Feb 2018 19:23:59 +0000

> I am vaguely interested in this.  Does it implement POSIX options?

Mostly. See https://git.suckless.org/sbase/tree/README

> does it only work with svc?  Do you have a link?

I am sure it does. It's correct in the vision of the project.

"What PID 1 Should Do
When your system boots up the kernel is executing a given binary in
its known namespace. To see what are the only tasks the application
running as pid 1 has to do, see sinit
(https://git.suckless.org/sinit/). Just wait for child process to reap
and run some other init scripts."

> Haven't heard of this one, is it from the same people as sbase?

nawk is bwk's awk, pigz is from zlib devs, iproute2 is everywhere these
days, sdhcp is a suckless project (https://git.2f30.org/sdhcp/).

> Have you looked in to pdcurses?  How does it compare?

I am afraid I haven't. Both should be rather compared to ncurses.

> yacc, etc in APK format :)

That's cool :) pkgsrc ships all Heirloom utilities, I think Arch does
too.
 
Cheers

--
caóc

---

---

From: "A. Wilcox" <[email-masked]>
Date: Mon, 12 Feb 2018 11:19:48 -0600

> (Maybe provides="/bin/sh" should be moved from busybox to tools-base

/bin/sh should be provided by a splitpackage of busybox (like
busybox-sh).  This way it can be changed without changing the tools
themselves.

This is what we do in Adélie; we have bash-binsh, busybox-binsh,
dash-binsh, zsh-binsh.  (The latter two are not recommended but there
for the people who want to experiment.)

I do like the idea of making base tools a virtual.  It would certainly
make my job easier!  :)

> awk, after dealing with it in Adelie Linux.

mawk has wider compatibility for some awk constructs than BusyBox awk.
I am unfortunately not sure exactly which constructs BB doesn't have as
I've never looked at the source, and my notes about that are long gone.

I can say that Adélie doesn't even *ship* gawk.  We replaced all
references to gawk with mawk locally with no ill effects.  Note we don't
ship the entire main and community repos so I am not advocating gawk's
removal in Alpine.  I am however advocating replacing it with mawk
wherever it makes sense.

Alpine edge gawk-4.2.0-r0 installed size:
847872

Adélie alpha4 mawk-20161120-r1 installed size:
172032

All the best,
--arw

---

From: Steffen Nurpmeso <[email-masked]>
Date: Mon, 12 Feb 2018 19:02:08 +0100

"A. Wilcox" <[email-masked]> wrote:
 |On 02/12/18 03:19, Przemysław Pawełczyk wrote:
 |> Hi, Alpiners!
 |> 
 |> What would you say about introducing new meta packages:
  ...
 |> - mawk
 |> 
 |> It's "an interpreter for the AWK Programming Language".
 |> It will possibly allow to make some packages depend on it instead of
 |> gawk.
 |> 
 |> I believe A. Wilcox can share details why it's better than busybox's
 |> awk, after dealing with it in Adelie Linux.
 |
 |
 |mawk has wider compatibility for some awk constructs than BusyBox awk.
 |I am unfortunately not sure exactly which constructs BB doesn't have as
 |I've never looked at the source, and my notes about that are long gone.
 |
 |I can say that Adélie doesn't even *ship* gawk.  We replaced all
 |references to gawk with mawk locally with no ill effects.  Note we don't
 |ship the entire main and community repos so I am not advocating gawk's
 |removal in Alpine.  I am however advocating replacing it with mawk
 |wherever it makes sense.

mawk does not support IGNORECASE=, whereas busybox awk (and gawk)
does.  Last month i tried to implement IGNORECASE= for mawk, but
whereas the normal regex case was somewhat easy, the homebrew
regex is too hard and i decided not to look deeper or even offer
Dickey an incomplete patch.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

---