[hackers] [PATCH 1/2] Add libutil/random.c for fast PCG-based PRNG

2024-12-19 Thread Elie Le Vaillant
--- Makefile | 1 + libutil/random.c | 87 util.h | 5 +++ 3 files changed, 93 insertions(+) create mode 100644 libutil/random.c diff --git a/Makefile b/Makefile index 4e20cb3..35c4c25 100644 --- a/Makefile +++ b/Makefile @@ -8

[hackers] [PATCH 2/2] cron: heavy refactor of parsefield() and matchentry()

2024-12-19 Thread Elie Le Vaillant
This patch heavily simplifies the parsing logic of parsefield(), and makes the grammar more standards-compliant. Before, this cron implementation would only recognize repeats ("/n" at the end of a range, or of a wildcar) for wildcars, and list elements could only be numbers. Now, the basic type i

Re: [hackers] [sbase][PATCH] cron: fix parsing and '~' behavior

2024-12-19 Thread Roberto E . Vargas Caballero
Quoth Elie Le Vaillant : > In parserange(), we tested wether range was null, to test wether or > not the repeat number was the end of the string (to test if we had > something like "*/3/34"). But it is str that we should be testing, > not range, as its value as a pointer doesn't mean anything in t

Re: [hackers] [sbase] tar: fix long names crashing tar archiving

2024-12-19 Thread Roberto E . Vargas Caballero
Quoth Andrea Calligaris : > It was already mentioned in Dec 2016 here: > https://lists.suckless.org/dev/1612/30852.html > but never fixed since. > > *Extracting* long paths was added in May 2022 here: > https://lists.suckless.org/hackers/2205/18321.html > but not *archiving*. > > Next thing to do

[hackers] [sbase] cron: heavy refactor of parsefield() and matchentry() || Elie Le Vaillant

2024-12-19 Thread git
commit 6c8dc1522ca47f65260f9605b6003fae547f9454 Author: Elie Le Vaillant AuthorDate: Fri Dec 6 10:37:35 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 11:40:06 2024 +0100 cron: heavy refactor of parsefield() and matchentry() This patch heavily simplifi

[hackers] [sbase] cron: fix parsing and '~' behavior || Elie Le Vaillant

2024-12-19 Thread git
commit 12c212e50580cbfa6d929ae444c67732af842cb7 Author: Elie Le Vaillant AuthorDate: Fri Dec 6 10:37:36 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 11:40:06 2024 +0100 cron: fix parsing and '~' behavior In parserange(), we tested wether range was nu

[hackers] [sbase] sort: remove useless allocation || Elie Le Vaillant

2024-12-19 Thread git
commit 2e6e8fe4306abe501e572dc29c459e19abeec8c4 Author: Elie Le Vaillant AuthorDate: Fri Dec 6 10:37:34 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 11:40:06 2024 +0100 sort: remove useless allocation I'm not sure why we're doing malloc() then memcpy

[hackers] [sbase] cron: fix '~' range parsing || Elie Le Vaillant

2024-12-19 Thread git
commit 74a1fbed375bac92df1f3fea36127945f071aa84 Author: Elie Le Vaillant AuthorDate: Fri Dec 6 10:37:47 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 11:40:06 2024 +0100 cron: fix '~' range parsing '~' after number was recognized as abnormal. diff --

[hackers] [sbase/ubase-merge] Move more things around || Roberto E. Vargas Caballero

2024-12-19 Thread git
commit bb367fd6c7a05bd60112ade77098b943a3ed62ef Author: Roberto E. Vargas Caballero AuthorDate: Fri Mar 22 04:32:56 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 16:20:39 2024 +0100 Move more things around diff --git a/ubase/fallocate.1 b/linux/fallocate.1 si

Re: [hackers] [sbase][PATCH] cron: fix repeat for random, and format code

2024-12-19 Thread Elie Le Vaillant
Hi, On Thu Dec 19, 2024 at 12:55 PM CET, Roberto E. Vargas Caballero wrote: > I am sorry, there are so many patches, just fixing them > that is impossible to follow anything. I am going to revert > the changes to cron, but I am going to keep the last version > of the random functions. > > Can you

Re: [hackers] [sbase][PATCH] sort: remove useless allocation

2024-12-19 Thread Roberto E . Vargas Caballero
Quoth Elie Le Vaillant : > I'm not sure why we're doing malloc() then memcpy() here, when > we could just make col->line.data point to start.data. This is costy > for huge sorts (3 time slower than other implementations with no real > reason). Since we are now working with the original line.data we

[hackers] [sbase/ubase-merge] Move more things around || Roberto E. Vargas Caballero

2024-12-19 Thread git
commit 7c207664f8acba7228cf7b9234fded698e07ed84 Author: Roberto E. Vargas Caballero AuthorDate: Fri Mar 22 04:32:56 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 15:38:32 2024 +0100 Move more things around diff --git a/ubase/mkswap.8 b/linux/mkswap.8 similari

[hackers] [sbase/ubase-merge] Move more things around || Roberto E. Vargas Caballero

2024-12-19 Thread git
commit 8291582b6ee219c6941dea3de87de1ed3f571636 Author: Roberto E. Vargas Caballero AuthorDate: Fri Mar 22 04:32:56 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 16:09:48 2024 +0100 Move more things around diff --git a/posix/libutil/concat.c b/libutil/concat.

[hackers] [PATCH] rev, tail: replace hardcoded code by UTF8_POINT macro

2024-12-19 Thread Elie Le Vaillant
--- rev.c | 2 +- tail.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rev.c b/rev.c index 2d89df1..9ac1da6 100644 --- a/rev.c +++ b/rev.c @@ -25,7 +25,7 @@ rev(FILE *fp) lf = n && line[n - 1] == '\n'; i = n -= lf; for (n =

[hackers] [sbase] head: remove useless buffering || Elie Le Vaillant

2024-12-19 Thread git
commit 83182aa959b2100ea0cf6766e6ef3a553877a710 Author: Elie Le Vaillant AuthorDate: Fri Dec 6 10:37:44 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 11:58:49 2024 +0100 head: remove useless buffering getline isn't useful here, because we just need to

Re: [hackers] [sbase][PATCH] head: remove useless buffering

2024-12-19 Thread Roberto E . Vargas Caballero
Quoth NRK : > > + while (i < n && (c = fgetc(fp)) != EOF) { > > + if (fputc(c, stdout) == EOF) > > I don't see this as an improvement. Each one of the fgetc and fputc are > going to go through a mutex lock (along with possibly going through a > call into a dynamic function). These kin

Re: [hackers] [sbase][PATCH] cron: fix repeat for random, and format code

2024-12-19 Thread Roberto E . Vargas Caballero
Quoth Elie Le Vaillant : > --- > cron.c | 10 -- > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/cron.c b/cron.c > index e95c661..9da0c8a 100644 I am sorry, there are so many patches, just fixing them that is impossible to follow anything. I am going to revert the chan

[hackers] [sbase] libutil/random: rewrite whole algorithm || Elie Le Vaillant

2024-12-19 Thread git
commit 11c53a1739e17c6fe5fb233e187e35d9600e6c60 Author: Elie Le Vaillant AuthorDate: Fri Dec 6 10:37:40 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 12:52:39 2024 +0100 libutil/random: rewrite whole algorithm libutil/random.c now includes a custom PR

[hackers] [sbase] cron: Revert to version before 6c8dc15 || Roberto E. Vargas Caballero

2024-12-19 Thread git
commit 5f6a3dad770e6e57218c3b82f96a8ed9b7a5a23d Author: Roberto E. Vargas Caballero AuthorDate: Thu Dec 19 12:53:24 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 12:53:24 2024 +0100 cron: Revert to version before 6c8dc15 The changes introduced after 6

[hackers] [sbase] libutil: add random.c || Elie Le Vaillant

2024-12-19 Thread git
commit 2677235ed7f86f26c817ca5eca7c730f2418638a Author: Elie Le Vaillant AuthorDate: Fri Dec 6 10:37:35 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 12:28:05 2024 +0100 libutil: add random.c Some programs need a good PRNG, such as shuf(1), or cron(1)

[hackers] [sbase/ubase-merge] Move more things around || Roberto E. Vargas Caballero

2024-12-19 Thread git
commit ca9f7351bbd0f8e6f9aa1cceb3e1910220aff399 Author: Roberto E. Vargas Caballero AuthorDate: Fri Mar 22 04:32:56 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 13:40:49 2024 +0100 Move more things around diff --git a/ubase/libutil/cp.c b/ubase/libutil/cp.c

[hackers] [sbase/ubase-merge] Move more things around || Roberto E. Vargas Caballero

2024-12-19 Thread git
commit 91aed23a5d5032b4a820a10bd3ddd6dd3968eefa Author: Roberto E. Vargas Caballero AuthorDate: Fri Mar 22 04:32:56 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 13:30:32 2024 +0100 Move more things around diff --git a/ubase/libutil/concat.c b/ubase/libutil/c

[hackers] [sbase/ubase-merge] Move more things around || Roberto E. Vargas Caballero

2024-12-19 Thread git
commit 6591fb94755d9f3c065add8ace0bf3747157 Author: Roberto E. Vargas Caballero AuthorDate: Fri Mar 22 04:32:56 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Dec 19 13:35:08 2024 +0100 Move more things around diff --git a/ubase/libutil/ealloc.c b/ubase/libutil/e

Re: [hackers] [sbase][PATCH] cron: fix repeat for random, and format code

2024-12-19 Thread Roberto E . Vargas Caballero
Hi, Quoth Elie Le Vaillant : > Will do. I made some tweaks to the random functions which improve > them somewhat (better constants, no reentrant versions). I also > added an ifdef that uses arc4random on OpenBSD. That seems nice. > > Maybe those aren't essential. The constants are objectively b

Re: [hackers] [sbase] head: remove useless buffering || Elie Le Vaillant

2024-12-19 Thread Hiltjo Posthuma
On Thu, Dec 19, 2024 at 11:59:35AM +0100, g...@suckless.org wrote: > commit 83182aa959b2100ea0cf6766e6ef3a553877a710 > Author: Elie Le Vaillant > AuthorDate: Fri Dec 6 10:37:44 2024 +0100 > Commit: Roberto E. Vargas Caballero > CommitDate: Thu Dec 19 11:58:49 2024 +0100 > > head: rem