[dev] Suggestion for project idea/christmas hacking: sbase xargs -P and -0 support

0 views
Skip to first unread message

Hiltjo Posthuma

unread,
Dec 13, 2024, 11:27:05 AM12/13/24
to d...@suckless.org
Hi,

I have a suggestion for sbase xargs.

It would be very useful to add the -0 (NUL separators) and -P (parallel jobs)
options.

Strictly speaking these options non-POSIX, but very useful.
Almost all implementations support them.

Maybe a nice project for new contributors who want to do some christmas
hacking? ;)


References:

- OpenBSD xargs -0 (1996-06-11):
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.2&content-type=text/x-cvsweb-markup
- OpenBSD xargs -P (2003-12-06):
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/xargs/xargs.c?rev=1.14&content-type=text/x-cvsweb-markup
- GNU findutils its initial git import has both options (Sun Feb 4 1996).
- Suckless project ideas / sbase TODO/README:
http://suckless.org/project_ideas/
http://git.suckless.org/sbase/file/README.html#l143
- POSIX xargs:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html

--
Kind regards,
Hiltjo

Marc Chantreux

unread,
Dec 13, 2024, 12:48:20 PM12/13/24
to dev mail list
Hello,

I have a question here: who uses sbase and why?

aside:

On Fri, Dec 13, 2024 at 05:25:54PM +0100, Hiltjo Posthuma wrote:
> It would be very useful to add the -0 (NUL separators) and -P (parallel jobs)
> options.

Can't agree more.

Another non-POSIX feature I really like is the date -f- and the hability
to write dates like: 'last week', 'next month' ' 1jan + 14 days'. I
always fall back on C when I use busybox.
I don't know if it's relevant but today, the tiny core I use is busybox
so I don't know how it maters but:

- Busybox findutils:
https://git.busybox.net/busybox/tree/findutils/xargs.c
( FEATURE_XARGS_SUPPORT_ZERO_TERM FEATURE_XARGS_SUPPORT_PARALLEL )

regards

--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79


Hiltjo Posthuma

unread,
Dec 13, 2024, 1:35:47 PM12/13/24
to dev mail list
Hi Marc,

Some use sbase for various cases, I did but i admit lately I don't use it.

Coincidently I recently tested some things on Tiny Core Linux with busybox.
It seems they disabled the xargs -P option (in Busybox it is normally enabled
by default).

--
Kind regards,
Hiltjo

Marc Chantreux

unread,
Dec 13, 2024, 6:13:39 PM12/13/24
to dev mail list
Hi Hiltjo,

> Coincidently I recently tested some things on Tiny Core Linux with busybox.

you just made me realize there is a linux distribution named Tiny Core
so I kept on browsing and realized there was interesting projects around
busybox. thanks.

--
Marc Chantreux

Страхиња Радић

unread,
Dec 14, 2024, 4:00:47 AM12/14/24
to dev mail list
Дана 24/12/13 06:12PM, Marc Chantreux написа:
> I have a question here: who uses sbase and why?

sbase is used by anyone interested, who values simplicity in software
(the main ideal of suckless software).

For example, I used it in my toy musl/Linux distro Galeb[1].

[1]: https://strahinja.srht.site/galeb/

Hiltjo Posthuma

unread,
Dec 14, 2024, 6:03:12 AM12/14/24
to dev mail list
Galeb looks cool, thanks for sharing.

And nice to see some inspirations were gained from morpheus and stali.

Theres also Oasis Linux, which looks interesting too:

https://github.com/oasislinux/oasis

--
Kind regards,
Hiltjo

Marc Chantreux

unread,
Dec 14, 2024, 6:04:29 AM12/14/24
to dev mail list
hello,

On Sat, Dec 14, 2024 at 09:59:37AM +0100, Страхиња Радић wrote:
> sbase is used by anyone interested, who values simplicity in software
> (the main ideal of suckless software).

I realize my question wasn't correctly asked. sorry about that.

> For example, I used it in my toy musl/Linux distro Galeb[1].
> [1]: https://strahinja.srht.site/galeb/

this was the kind of answer I had in mind: distros, projects,
explainations on why people chose sbase instead of coreutils or
busybox.

regards

--
Marc Chantreux

Marc Chantreux

unread,
Dec 14, 2024, 6:23:55 AM12/14/24
to dev mail list
> Theres also Oasis Linux, which looks interesting too:
> https://github.com/oasislinux/oasis

lot of lua there which was something that really made me run away
(the infrastructure is fantastic but the langage is terrible).
now I use fennel (https://fennel-lang.org/) so I should give oasis
a try again. But yes: Gabel seems interesting too.

regards,

--
Marc Chantreux

Laslo Hunhold

unread,
Dec 14, 2024, 7:30:02 AM12/14/24
to d...@suckless.org
On Sat, 14 Dec 2024 12:03:37 +0100
Marc Chantreux <m...@unistra.fr> wrote:

Dear Marc,

> > For example, I used it in my toy musl/Linux distro Galeb[1].
> > [1]: https://strahinja.srht.site/galeb/
>
> this was the kind of answer I had in mind: distros, projects,
> explainations on why people chose sbase instead of coreutils or
> busybox.

Google's Fuchsia uses sbase in userspace, if the aforementioned
examples were not already enough. This means that sbase is (factually)
installed on millions of devices worldwide, given at least Google's
Nest Hub runs Fuchsia.

Some background: Google chose sbase because it's so well-portable and
non-GPL. The coreutils aren't (and are GPL), same with busybox.

With best regards

Laslo

[0]:https://fuchsia.googlesource.com/third_party/sbase/

Marc Chantreux

unread,
Dec 14, 2024, 7:47:58 AM12/14/24
to dev mail list
Laslo! I'm so happy to read from you.

On Sat, Dec 14, 2024 at 01:28:50PM +0100, Laslo Hunhold wrote:
> Google's Fuchsia uses sbase in userspace, if the aforementioned
> examples were not already enough. This means that sbase is (factually)
> installed on millions of devices worldwide, given at least Google's
> Nest Hub runs Fuchsia.
>
> Some background: Google chose sbase because it's so well-portable and
> non-GPL. The coreutils aren't (and are GPL), same with busybox.

Which is an awesome example! thanks a lot.

Don't you think it's worth mentionning Gabel and Fuchsia in the sbase
homepage or in the README? (I can take care of it).


regards,

--
Marc Chantreux

Elie Le Vaillant

unread,
Dec 15, 2024, 9:28:10 AM12/15/24
to dev mail list
Hey,

On Fri Dec 13, 2024 at 6:12 PM CET, Marc Chantreux wrote:
> Another non-POSIX feature I really like is the date -f- and the hability
> to write dates like: 'last week', 'next month' ' 1jan + 14 days'. I
> always fall back on C when I use busybox.

Once upon a time, I made quite a few changes to sbase, and added a few tools.

Here's: https://codeberg.org/Eolien55/sbase

I think I'll try to do this precisely. That is, add OpenBSD-like strptime
functionality (1), modify -d flag to be in accord with this (2), and add
modifiers like '+', 'next', and so on and so forth.

Maybe I'll try re-sending those patches. Last time, we had a discussion
on the scope of sbase. But I think some patches are still relevant nonetheless
(the cron one in particular).

Cheers,
Elie Le Vaillant

Roberto E. Vargas Caballero

unread,
Dec 17, 2024, 4:36:58 AM12/17/24
to dev mail list
Hi,

On Sun, Dec 15, 2024 at 03:27:34PM +0100, Elie Le Vaillant wrote:
> Maybe I'll try re-sending those patches. Last time, we had a discussion
> on the scope of sbase. But I think some patches are still relevant nonetheless
> (the cron one in particular).

I was reading old mails and I found that I lost several mails about sbase
and I am going to try to keep updated about them, but if you can send them
again it would make my life easier.

Regards,

dormouse

unread,
Dec 17, 2024, 4:08:56 PM12/17/24
to d...@suckless.org
I might look into this, sounds fun.
It's gonna be my first experimenting with alt
coreutils tho, if you have any tips/tricks, feel free to share.

Thank you for your time.
--
Dormouse

Reply all
Reply to author
Forward
0 new messages