[hackers][dwm][patch] statuscolors

2024-05-11 Thread Dr . André Desgualdo Pereira
Good day for everyone! <3 The dwm patch "statuscolors" has a bug. It ads a blank space at the right side of the status bar. It is worse the change of colors the status has. Example: # normal: xsetroot -name " a status full of info and different colors will have a long blank space on the right

Re: [hackers] [st][PATCH] sgr-patch

2024-05-01 Thread Hiltjo Posthuma
On Mon, Apr 29, 2024 at 08:18:00PM +0100, Mikhail Kot wrote: > Hi! > > Sorry, didn't see your message. > SGR allows you to specify color delimiters in two way: colon > or semicolon. The semicolon version is now legacy one, and many > applications, e.g. aerc (its library vaxis-ui, to be precise) >

[hackers] [st] support colons in SGR character attributes || Hiltjo Posthuma

2024-05-01 Thread git
commit 5dbcca49263be094fc38159c297458ae323ef647 Author: Hiltjo Posthuma AuthorDate: Wed May 1 20:45:39 2024 +0200 Commit: Hiltjo Posthuma CommitDate: Wed May 1 20:45:39 2024 +0200 support colons in SGR character attributes Patch by Mikhail Kot With some modifications

Re: [hackers] [st][PATCH] sgr-patch

2024-04-29 Thread Roberto E. Vargas Caballero
Hi, On Mon, Apr 29, 2024 at 08:18:00PM +0100, Mikhail Kot wrote: > Sorry, didn't see your message. > SGR allows you to specify color delimiters in two way: colon > or semicolon. The semicolon version is now legacy one, and many > applications, e.g. aerc (its library vaxis-ui, to be precise) > use

Re: [hackers] [st][PATCH] sgr-patch

2024-04-29 Thread Mikhail Kot
Hi! Sorry, didn't see your message. SGR allows you to specify color delimiters in two way: colon or semicolon. The semicolon version is now legacy one, and many applications, e.g. aerc (its library vaxis-ui, to be precise) use colons by default. I believe it's better to support both versions --

Re: [hackers] [st][PATCH] sgr-patch

2024-04-19 Thread Quentin Rameau
Hi Mikhail, > Colon-separated SGR (new version; ':' is the legacy one) Could explain a bit more what this patch is about, with some context and telling the goal?

[hackers] [st][PATCH] sgr-patch

2024-04-18 Thread Mikhail Kot
Colon-separated SGR (new version; ':' is the legacy one) --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index b9f66e7..7c1cb9a 100644 --- a/st.c +++ b/st.c @@ -1149,7 +1149,7 @@ csiparse(void) v = -1;

[hackers] [st][PATCH] sgr-patch

2024-04-18 Thread Mikhail Kot
Colon-separated SGR --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index b9f66e7..7c1cb9a 100644 --- a/st.c +++ b/st.c @@ -1149,7 +1149,7 @@ csiparse(void) v = -1; csiescseq.arg[csiescseq.narg++] = v;

[hackers] [st] bump version to 0.9.2 || Hiltjo Posthuma

2024-04-05 Thread git
commit d63b9eb90245926b531bd54b1d591adb96613e70 Author: Hiltjo Posthuma AuthorDate: Fri Apr 5 12:18:41 2024 +0200 Commit: Hiltjo Posthuma CommitDate: Fri Apr 5 12:18:41 2024 +0200 bump version to 0.9.2 diff --git a/config.mk b/config.mk index 7f35f71..fdc29a7 100644 --- a/config.mk

Re: [hackers] [st][PATCH] Reset title when an empty title string is given

2024-04-03 Thread Hiltjo Posthuma
On Tue, Apr 02, 2024 at 09:41:15PM -0400, DOGMAN wrote: > With this patch, st will reset its window title when an empty string is > given as the terminal title. For example: > printf "\033]0;\007" > > Some applications, like termdown, expect this functionality. xterm > implements it, but it

[hackers] [st] Reset title when an empty title string is given || DOGMAN

2024-04-03 Thread git
commit 497a75638291454875ba1ec8d484c7f3d6f41d66 Author: DOGMAN AuthorDate: Wed Apr 3 19:48:11 2024 +0200 Commit: Hiltjo Posthuma CommitDate: Wed Apr 3 19:49:05 2024 +0200 Reset title when an empty title string is given With this patch, st will reset its window title when an

[hackers] [st][PATCH] Reset title when an empty title string is given

2024-04-02 Thread DOGMAN
With this patch, st will reset its window title when an empty string is given as the terminal title. For example: printf "\033]0;\007" Some applications, like termdown, expect this functionality. xterm implements it, but it seems that most other terminal emulators don't. In any case, I

Re: [hackers] [st] Fix cursor move with wide glyphs || Quentin Rameau

2024-03-30 Thread Hiltjo Posthuma
On Sat, Mar 30, 2024 at 01:59:28AM +0100, Storkman wrote: > On Fri, Mar 29, 2024 at 07:27:43PM +0100, Hiltjo Posthuma wrote: > > On Wed, Mar 27, 2024 at 04:11:27PM +0100, Storkman wrote: > > > On Sun, Feb 25, 2024 at 11:57:03AM +0100, g...@suckless.org wrote: > > > > commit

[hackers] [st] Revert "Fix cursor move with wide glyphs" || Hiltjo Posthuma

2024-03-30 Thread git
commit 8c68ec52419f3f965164cafcf589b87e8961348d Author: Hiltjo Posthuma AuthorDate: Sat Mar 30 12:30:49 2024 +0100 Commit: Hiltjo Posthuma CommitDate: Sat Mar 30 12:37:06 2024 +0100 Revert "Fix cursor move with wide glyphs" This reverts commit

Re: [hackers] [st] Fix cursor move with wide glyphs || Quentin Rameau

2024-03-30 Thread Страхиња Радић
On 24/03/30 01:59AM, Storkman wrote: > For a specific example, copy text followed by a wide glyph into bash > or mksh, e.g. > A字 > and press backspace once. Both characters will be erased. Or, when using tmux, split vertically, then in the right pane copy the above text and press left

Re: [hackers] [st] Fix cursor move with wide glyphs || Quentin Rameau

2024-03-29 Thread Storkman
On Fri, Mar 29, 2024 at 07:27:43PM +0100, Hiltjo Posthuma wrote: > On Wed, Mar 27, 2024 at 04:11:27PM +0100, Storkman wrote: > > On Sun, Feb 25, 2024 at 11:57:03AM +0100, g...@suckless.org wrote: > > > commit 7473a8d1a57e5f9aba41b953f4e498c35e1c9dc5 > > > Author: Quentin Rameau > > >

Re: [hackers] [st] Fix cursor move with wide glyphs || Quentin Rameau

2024-03-29 Thread Hiltjo Posthuma
On Wed, Mar 27, 2024 at 04:11:27PM +0100, Storkman wrote: > On Sun, Feb 25, 2024 at 11:57:03AM +0100, g...@suckless.org wrote: > > commit 7473a8d1a57e5f9aba41b953f4e498c35e1c9dc5 > > Author: Quentin Rameau > > AuthorDate: Sun Feb 25 01:31:31 2024 +0100 > > Commit: Hiltjo Posthuma > >

Re: [hackers] [st] Fix cursor move with wide glyphs || Quentin Rameau

2024-03-27 Thread Storkman
On Sun, Feb 25, 2024 at 11:57:03AM +0100, g...@suckless.org wrote: > commit 7473a8d1a57e5f9aba41b953f4e498c35e1c9dc5 > Author: Quentin Rameau > AuthorDate: Sun Feb 25 01:31:31 2024 +0100 > Commit: Hiltjo Posthuma > CommitDate: Sun Feb 25 11:56:43 2024 +0100 > > Fix cursor move with

[hackers] [sbase] ed: Add other pending bug || Roberto E. Vargas Caballero

2024-03-21 Thread git
commit b30fb56804bfed69b45ef0e944d2e029e4d26258 Author: Roberto E. Vargas Caballero AuthorDate: Fri Mar 22 04:39:25 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Fri Mar 22 04:39:25 2024 +0100 ed: Add other pending bug At this stage is clear that the match()

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

2024-03-21 Thread git
commit 23f879d1dcd82674ce51b1d453eedf4b334ef04f Author: Roberto E. Vargas Caballero AuthorDate: Fri Mar 22 04:32:56 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Fri Mar 22 04:32:56 2024 +0100 Move more things around diff --git a/ubase/blkdiscard.8 b/linux/blkdiscard.8

[hackers] [tabbed] bump version to 0.8 || Hiltjo Posthuma

2024-03-19 Thread git
commit 7215169fbbb1f81c3bad49b847d1e5907f6ab70c Author: Hiltjo Posthuma AuthorDate: Tue Mar 19 12:12:32 2024 +0100 Commit: Hiltjo Posthuma CommitDate: Tue Mar 19 12:12:32 2024 +0100 bump version to 0.8 diff --git a/Makefile b/Makefile index 54ba350..dda3cdb 100644 --- a/Makefile

[hackers] [dmenu] bump version to 5.3 || Hiltjo Posthuma

2024-03-19 Thread git
commit 7be720cc88ed2294338f7182600df10f21c575ce Author: Hiltjo Posthuma AuthorDate: Tue Mar 19 12:12:52 2024 +0100 Commit: Hiltjo Posthuma CommitDate: Tue Mar 19 12:12:52 2024 +0100 bump version to 5.3 diff --git a/config.mk b/config.mk index 566348b..137f7c8 100644 --- a/config.mk

[hackers] [dwm] bump version to 6.5 || Hiltjo Posthuma

2024-03-19 Thread git
commit 061e9fe9a7db396c0c4f3d996c3908fb43a6d50c Author: Hiltjo Posthuma AuthorDate: Tue Mar 19 12:13:16 2024 +0100 Commit: Hiltjo Posthuma CommitDate: Tue Mar 19 12:13:16 2024 +0100 bump version to 6.5 diff --git a/config.mk b/config.mk index ba64d3d..8efca9a 100644 --- a/config.mk

[hackers] [st] bump version to 0.9.1 || Hiltjo Posthuma

2024-03-19 Thread git
commit 5ce971628106fb767ef91bf4386227423f5fdf98 Author: Hiltjo Posthuma AuthorDate: Tue Mar 19 12:13:42 2024 +0100 Commit: Hiltjo Posthuma CommitDate: Tue Mar 19 12:13:42 2024 +0100 bump version to 0.9.1 diff --git a/config.mk b/config.mk index 1e306f8..7f35f71 100644 ---

[hackers] [st] config.def.h: improve latency for the default configuration || Hiltjo Posthuma

2024-03-17 Thread git
commit f20e169a20f3ee761f7e09714f1d4c10916cf4c6 Author: Hiltjo Posthuma AuthorDate: Sun Mar 17 14:42:44 2024 +0100 Commit: Hiltjo Posthuma CommitDate: Sun Mar 17 14:42:44 2024 +0100 config.def.h: improve latency for the default configuration diff --git a/config.def.h b/config.def.h

[hackers] [slstatus][PATCH] add 'up' for whether a interface is up or down

2024-03-15 Thread sewn
--- components/ip.c | 26 ++ config.def.h| 1 + slstatus.h | 1 + 3 files changed, 28 insertions(+) diff --git a/components/ip.c b/components/ip.c index 9476549..2cdad46 100644 --- a/components/ip.c +++ b/components/ip.c @@ -1,6 +1,7 @@ /* See LICENSE file for

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

2024-03-13 Thread git
commit ba7741a7bc6ebc7e7d90076f69757d93f43d0a34 Author: Roberto E. Vargas Caballero AuthorDate: Wed Mar 13 12:07:59 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 13 12:07:59 2024 +0100 Move things out of ubase diff --git a/ubase/chvt.1 b/linux/chvt.1 similarity

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

2024-03-13 Thread git
commit bbd10e0d3036a40260f41eae445488baf7bf27a1 Author: Roberto E. Vargas Caballero AuthorDate: Wed Mar 13 13:47:59 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 13 13:47:59 2024 +0100 Move more things around diff --git a/ubase/ctrlaltdel.8 b/linux/ctrlaltdel.8

[hackers] [sbase/ubase-merge] Move non posix tools out of sbase || Roberto E. Vargas Caballero

2024-03-13 Thread git
commit 5c804bdf5696ed20a46fcdc76981af75ba65 Author: Roberto E. Vargas Caballero AuthorDate: Wed Mar 13 11:41:28 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 13 11:52:40 2024 +0100 Move non posix tools out of sbase diff --git a/ubase/clear.1

[hackers] [sbase/ubase-merge] Move non posix tools out of sbase || Roberto E. Vargas Caballero

2024-03-13 Thread git
commit 5335e18bc135e4917124f02062fa634e5af23d0f Author: Roberto E. Vargas Caballero AuthorDate: Wed Mar 13 11:41:28 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 13 11:42:27 2024 +0100 Move non posix tools out of sbase diff --git a/ubase/clear.1

[hackers] [sbase/ubase-merge] Move sbase into a subdirectory || Roberto E. Vargas Caballero

2024-03-13 Thread git
commit 232b10bcd8bc7cce3dfaff36858dfd81fd453a47 Author: Roberto E. Vargas Caballero AuthorDate: Tue Mar 12 21:44:03 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Tue Mar 12 21:44:03 2024 +0100 Move sbase into a subdirectory diff --git a/LICENSE b/sbase/LICENSE

[hackers] [sbase] build: Fix sbase-box-install target || Roberto E. Vargas Caballero

2024-03-12 Thread git
commit ac6d382515327bf0bf14d5d355d33ceffddc7fd7 Author: Roberto E. Vargas Caballero AuthorDate: Tue Mar 12 17:11:35 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Tue Mar 12 17:11:35 2024 +0100 build: Fix sbase-box-install target The target tried to execute a

Re: [hackers] [sbase][PATCH] Add implementation of tac(1)

2024-03-07 Thread Roberto E. Vargas Caballero
Hi, As this is a topic more about sbase/ubase organization more than about patches I am going to move the discussion to the dev mailing list. Please, answer there instead of here in hackers. Regards,

Re: [hackers] [sbase][PATCH] Add implementation of tac(1)

2024-03-07 Thread Roberto E. Vargas Caballero
Hi, I was thinking about what to do with these patches adding new commands. They raised a concern about what should be the scope of sbase. The idea of sbase was to provide a minimal portable POSIX base, while having ubase for the POSIX commands that cannot be implemented in a portable way.

[hackers] [sbase][PATCH] tar: support hardlinks during compression

2024-03-07 Thread Andrea Calligaris
This patch depends on: "tar: fix long names crashing tar archiving" https://lists.suckless.org/hackers/2402/19071.html I just did the simplest possible implementation, in order to have at least something (it's a feature of 'tar' that I do actually use in my projects, so I needed it)

Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-07 Thread Roberto E. Vargas Caballero
Hi, On Thu, Mar 07, 2024 at 02:52:49PM -0500, neeshy wrote: > On Thu Mar 7, 2024 at 1:19 PM EST, Roberto E. Vargas Caballero wrote: > > I think it makes it simpler while keeping the correct behaviour that I > > broke. > > Looks good to me! Pushed!

[hackers] [ubase] su: Fix running it without arguments The commit 8f5a0c3 introduced a regression and the logic to control the number of arguments was broken after it, giving an error when su was exec

2024-03-07 Thread git
commit a570a80ed1606bed43118cb148fc83c3ac22b5c1 Author: Roberto E. Vargas Caballero AuthorDate: Thu Mar 7 22:35:31 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Thu Mar 7 22:35:31 2024 +0100 su: Fix running it without arguments The commit 8f5a0c3 introduced a

[hackers] [sbase][PATCH] cron: fix '~' range parsing

2024-03-07 Thread Elie Le Vaillant
'~' after number was recognized as abnormal. --- cron.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cron.c b/cron.c index 9da0c8a..18ee8b1 100644 --- a/cron.c +++ b/cron.c @@ -252,7 +252,7 @@ parserange(char *str, long low, long high, struct range *r)

Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-07 Thread neeshy
On Thu Mar 7, 2024 at 1:19 PM EST, Roberto E. Vargas Caballero wrote: > I think it makes it simpler while keeping the correct behaviour that I broke. Looks good to me!

Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-07 Thread Roberto E. Vargas Caballero
Hi, On Thu, Mar 07, 2024 at 02:18:28AM -0500, neeshy wrote: > It seems that the modifications you made break the use case where su is > called without a username. It would normally default to the root > user, but now it invokes usage() instead. My original patch worked as > intended. Could you

[hackers] [sbase][PATCH] libutil/random: cast to long to avoid overflow

2024-03-07 Thread Elie Le Vaillant
Thanks NRK --- libutil/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libutil/random.c b/libutil/random.c index d5214ae..aa98d61 100644 --- a/libutil/random.c +++ b/libutil/random.c @@ -67,7 +67,7 @@ rng32_seed_r(uint64_t *state) { struct timespec ts;

Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-06 Thread neeshy
On Wed Mar 6, 2024 at 4:14 AM EST, Roberto E. Vargas Caballero wrote: > Hi, > > > On Mon, Feb 12, 2024 at 04:25:49PM -0500, neeshy wrote: > > Inline dologin, and simplify common code > > I have applied the 4 patches with a minor modification to the 1st > one. > > Kind regards, > Roberto Vargas.

[hackers] [sbase][PATCH] TODO: libutil/unescape: add NUL escapes

2024-03-06 Thread Elie Le Vaillant
--- TODO | 8 1 file changed, 8 insertions(+) diff --git a/TODO b/TODO index 6a0968e..a924aee 100644 --- a/TODO +++ b/TODO @@ -73,6 +73,14 @@ tr * When a character class is present, all other characters in the string are ignored. +libutil +--- +* unescape: NUL ('\0') escapes

Re: [hackers] [sbase][PATCH] tar: chktar: fix conditional typo

2024-03-06 Thread Roberto E. Vargas Caballero
Hi, On Tue, Mar 05, 2024 at 09:20:57PM +0100, Elie Le Vaillant wrote: > --- > tar.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tar.c b/tar.c > index 0361b63..405b8d9 100644 > --- a/tar.c > +++ b/tar.c > @@ -423,7 +423,7 @@ chktar(struct header *h) >

[hackers] [sbase] tar: chktar: fix conditional typo || Elie Le Vaillant

2024-03-06 Thread git
commit 13898fa7a91155a60c4c0bd61d4b7693a2ff3f09 Author: Elie Le Vaillant AuthorDate: Tue Mar 5 21:20:57 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 6 16:00:10 2024 +0100 tar: chktar: fix conditional typo diff --git a/tar.c b/tar.c index 5f73c26..7529997

[hackers] [ubase] su: don't set $PATH || neeshy

2024-03-06 Thread git
commit 4cd0b143801b1135abd2b7012cfed020710a4e68 Author: neeshy AuthorDate: Mon Feb 12 21:03:12 2024 -0500 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 6 10:12:49 2024 +0100 su: don't set $PATH Just /bin is too restrictive, and login shells set the path anyway via

[hackers] [ubase] su: fix setting argv0 || neeshy

2024-03-06 Thread git
commit cf9e26d7fa2d13ede8ce2830819e311fc0dd83b9 Author: neeshy AuthorDate: Mon Feb 12 16:25:50 2024 -0500 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 6 10:11:23 2024 +0100 su: fix setting argv0 argv0 was being set to the user's login shell even when -p was

[hackers] [ubase] su: check $SHELL for validity || neeshy

2024-03-06 Thread git
commit e9bcdcc341d74f0abaa171703ac031b55e9020c0 Author: neeshy AuthorDate: Mon Feb 12 21:41:02 2024 -0500 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 6 10:11:29 2024 +0100 su: check $SHELL for validity If $SHELL isn't defined in the environment, the call to

[hackers] [ubase] su: simplify logic || neeshy

2024-03-06 Thread git
commit 8f5a0c32362dc447ab066f9c3ad7802153a6bb40 Author: neeshy AuthorDate: Mon Feb 12 21:26:35 2024 -0500 Commit: Roberto E. Vargas Caballero CommitDate: Wed Mar 6 10:11:07 2024 +0100 su: simplify logic Inline dologin, and simplify common code diff --git a/su.c b/su.c

Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-06 Thread Roberto E. Vargas Caballero
Hi, On Mon, Feb 12, 2024 at 04:25:49PM -0500, neeshy wrote: > Inline dologin, and simplify common code I have applied the 4 patches with a minor modification to the 1st one. Kind regards, Roberto Vargas.

Re: [hackers] [sbase][PATCH] libutil/random: better random seed

2024-03-05 Thread NRK
> - *state = ts.tv_nsec; > + *state = (intptr_t) ^ time(NULL) ^ (ts.tv_nsec * 0xAC5533CD); tv_nsec is `long` which is signed. Signed interger overflow is undefined. You need to cast it to `unsigned long` before multiply: ... ^ ((unsigned long)ts.tv_nsec * 0xAC5533CD) - NRK

Re: [hackers] [sbase][PATCH] libutil/random: better random seed

2024-03-05 Thread Steve Ward
On Mon, Mar 4, 2024 at 5:03 PM Elie Le Vaillant wrote: > > Thanks NRK > --- > libutil/random.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libutil/random.c b/libutil/random.c > index 780ba29..6b795a9 100644 > --- a/libutil/random.c > +++ b/libutil/random.c > @@

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

2024-03-05 Thread 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). I think the current solution

[hackers] [sbase][PATCH] tar: chktar: fix conditional typo

2024-03-05 Thread Elie Le Vaillant
--- tar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tar.c b/tar.c index 0361b63..405b8d9 100644 --- a/tar.c +++ b/tar.c @@ -423,7 +423,7 @@ chktar(struct header *h) goto bad; } memcpy(tmp, h->chksum, sizeof(tmp)); - for (i = 0; i <

Re: [hackers] [sbase][PATCH] Add implementation of tac(1)

2024-03-05 Thread Eric Pruitt
On Sun, Mar 03, 2024 at 12:34:16AM +0100, Elie Le Vaillant wrote: > +static void > +tac(FILE *fp) > +{ > + struct linebuf buf = EMPTY_LINEBUF; > + struct line line; > + getlines(fp, ); > + > + if (buf.nolf) { > + /* If the last line is not LF-terminated, the > +

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

2024-03-05 Thread Elie Le Vaillant
getline isn't useful here, because we just need to read then output lines. We do not need anything more complex than counting '\n's, so we shouldn't use a buffer like we currently do. --- head.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/head.c b/head.c

[hackers] [sbase][PATCH] libutil/random: no need to call time() when we have timespec

2024-03-05 Thread Elie Le Vaillant
Thanks Steve Ward --- libutil/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libutil/random.c b/libutil/random.c index 6b795a9..d5214ae 100644 --- a/libutil/random.c +++ b/libutil/random.c @@ -67,7 +67,7 @@ rng32_seed_r(uint64_t *state) { struct timespec ts;

Re: [hackers] [sbase][PATCH v3] tar: sanitize, chktar: leading spaces should be skipped over

2024-03-05 Thread Roberto E. Vargas Caballero
Hi, On Sun, Feb 11, 2024 at 09:26:14AM +0100, Elie Le Vaillant wrote: > Some tar archives (eg. ftp://ftp.gnu.org/gnu/shtool/shtool-2.0.8.tar.gz) > use leading spaces instead of leading zeroes for numeric fields. > Although it is not allowed by the ustar specification, most tar > implementations

[hackers] [sbase] tar: sanitize, chktar: leading spaces should be skipped over || Elie Le Vaillant

2024-03-05 Thread git
commit bca3fcca91cfb6ee64434776aa20209547816c17 Author: Elie Le Vaillant AuthorDate: Sun Feb 11 09:26:14 2024 +0100 Commit: Roberto E. Vargas Caballero CommitDate: Tue Mar 5 13:25:44 2024 +0100 tar: sanitize, chktar: leading spaces should be skipped over Some tar archives

Re: [hackers] [sbase][PATCH v2] tar: sanitize: leading zeros should be recognized

2024-03-05 Thread Roberto E. Vargas Caballero
On Tue, Mar 05, 2024 at 01:16:36PM +0100, Roberto E. Vargas Caballero wrote: > Hi, > > On Sat, Feb 10, 2024 at 11:57:38PM +0100, Elie Le Vaillant wrote: > > @@ -399,10 +400,17 @@ sanitize(struct header *h) > > for (i = 0; i < LEN(fields); i++) > > - for (j = 0; j < fields[i].l; j++)

Re: [hackers] [sbase][PATCH v2] tar: sanitize: leading zeros should be recognized

2024-03-05 Thread Roberto E. Vargas Caballero
Hi, On Sat, Feb 10, 2024 at 11:57:38PM +0100, Elie Le Vaillant wrote: > @@ -399,10 +400,17 @@ sanitize(struct header *h) > for (i = 0; i < LEN(fields); i++) > - for (j = 0; j < fields[i].l; j++) > + for (leading = 1, j = 0; j < fields[i].l; j++) >

Re: [hackers] [sbase][PATCH] Add implementation of tac(1)

2024-03-04 Thread Eolien55
Eric Pruitt wrote: > I think there should be separate implementations for seekable vs > non-seekable files to avoid buffering the entire contents of > the file in memory unnecessarily. In fact, performance could be also improved for non-seekable files by forcing a seekable context, ie. use a

Re: [hackers] [st][PATCH] set upper limit for REP escape sequence argument

2024-03-04 Thread Hiltjo Posthuma
On Mon, Mar 04, 2024 at 10:24:36PM +0200, Tommi Hirvola wrote: > On Mon, Mar 04, 2024 at 01:55:29PM +0100, Hiltjo Posthuma wrote: > > I'm not sure about it. You could still chain REP sequences and "DoS" it. > > Fortunately, chained REP sequences can be terminated with ^C. You can > try this by

[hackers] [st] set upper limit for REP escape sequence argument || Tommi Hirvola

2024-03-04 Thread git
commit 95f22c53059ccd60ee701ccf2659dacd95e4e89a Author: Tommi Hirvola AuthorDate: Mon Mar 4 12:56:30 2024 +0200 Commit: Hiltjo Posthuma CommitDate: Mon Mar 4 23:50:58 2024 +0100 set upper limit for REP escape sequence argument Previously, printf 'L\033[2147483647b' would

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

2024-03-04 Thread 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 --- a/cron.c +++ b/cron.c @@ -287,19 +287,17 @@ parserange(char *str, long low, long high, struct range *r) r->repeat = strtol(repeat, , 10);

[hackers] [sbase][PATCH] libutil/random: better random seed

2024-03-04 Thread Elie Le Vaillant
Thanks NRK --- libutil/random.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libutil/random.c b/libutil/random.c index 780ba29..6b795a9 100644 --- a/libutil/random.c +++ b/libutil/random.c @@ -1,4 +1,5 @@ #include +#include #include static uint64_t globalstate; @@

Re: [hackers] [st][PATCH] set upper limit for REP escape sequence argument

2024-03-04 Thread Tommi Hirvola
On Mon, Mar 04, 2024 at 01:55:29PM +0100, Hiltjo Posthuma wrote: > I'm not sure about it. You could still chain REP sequences and "DoS" it. Fortunately, chained REP sequences can be terminated with ^C. You can try this by copy-pasting the following line into st and pressing CTRL+C: $ for i in

[hackers] [sbase][PATCH] realpath: add man pages

2024-03-04 Thread Elie Le Vaillant
--- readlink.1 | 1 + realpath.1 | 20 2 files changed, 21 insertions(+) create mode 100644 realpath.1 diff --git a/readlink.1 b/readlink.1 index 46b4cad..d5993ce 100644 --- a/readlink.1 +++ b/readlink.1 @@ -28,5 +28,6 @@ by recursively following every symlink in its path

[hackers] [sbase][PATCH] Add implementation of realpath(1)

2024-03-04 Thread Elie Le Vaillant
--- .gitignore | 1 + Makefile | 1 + realpath.c | 34 ++ 3 files changed, 36 insertions(+) create mode 100644 realpath.c diff --git a/.gitignore b/.gitignore index e789e24..f1ce1c2 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ /printf /pwd

Re: [hackers] [st][PATCH] set upper limit for REP escape sequence argument

2024-03-04 Thread Hiltjo Posthuma
On Mon, Mar 04, 2024 at 12:56:30PM +0200, Tommi Hirvola wrote: > Previously, printf 'L\033[2147483647b' would call tputc('L') 2^31 times, > making st unresponsive. This commit allows repeating the last character > at most 65535 times in order to prevent freezing and DoS attacks. > --- > st.c | 2

[hackers] [st][PATCH] set upper limit for REP escape sequence argument

2024-03-04 Thread Tommi Hirvola
Previously, printf 'L\033[2147483647b' would call tputc('L') 2^31 times, making st unresponsive. This commit allows repeating the last character at most 65535 times in order to prevent freezing and DoS attacks. --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c

Re: [hackers] Re: [sbase] Orphan patches and unsent patches

2024-03-03 Thread NRK
On Sun, Mar 03, 2024 at 03:05:47PM +0100, Eolien55 wrote: > but should we not rather implement "Debiased Int Mult (t-opt)"? Both should be fine. The integer mul method avoids clz() so that could be a reason to prefer it. > arc4random(3) doesn't uses seeds, which means that I cannot initialize >

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

2024-03-03 Thread 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 should be supporting links while archiving

[hackers] [sbase][PATCH] tar: force decompression

2024-03-03 Thread Elie Le Vaillant
decomp() needs the force flag -f too. --- tar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tar.c b/tar.c index 5f73c26..0361b63 100644 --- a/tar.c +++ b/tar.c @@ -593,7 +593,7 @@ main(int argc, char *argv[]) if (filtertool) { fd =

[hackers] [sbase][PATCH] cron: use new libutil/random

2024-03-03 Thread Elie Le Vaillant
--- cron.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cron.c b/cron.c index 126ebf1..e95c661 100644 --- a/cron.c +++ b/cron.c @@ -294,7 +294,7 @@ parserange(char *str, long low, long high, struct range *r) if (random) { /* random replaces low

[hackers] [sbase][PATCH] shuf: use new libutil/random

2024-03-03 Thread Elie Le Vaillant
--- shuf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shuf.c b/shuf.c index 36b3898..21210de 100644 --- a/shuf.c +++ b/shuf.c @@ -47,11 +47,11 @@ main(int argc, char *argv[]) } } - random_seed(); + rng32_seed(); if

[hackers] [sbase][PATCH] libutil/random: rewrite whole algorithm

2024-03-03 Thread Elie Le Vaillant
libutil/random.c now includes a custom PRNG, which is the PCG family. It also overhauls random_uniform(), making it way faster. Names were changed (s/random/rng32/g), and reentrant versions added. The PRNG is faster than libc's random(). It is way faster than the previous version, which used ---

Re: [hackers] Re: [sbase] Orphan patches and unsent patches

2024-03-03 Thread Eolien55
NRK wrote: > I'd recommend using the bitmask approach described in here: > https://www.pcg-random.org/posts/bounded-rands.html#bitmask-with-rejection-unbiased-apples-method I thought the approach used by OpenBSD was simpler, and performed better, becaused it avoided the loop, which might cause

Re: [hackers] Re: [sbase] Orphan patches and unsent patches

2024-03-02 Thread NRK
On Sun, Mar 03, 2024 at 12:58:20AM +0100, Elie Le Vaillant wrote: > I'm using the web interface to the mailing list to check what has been > sent, and these patches were not sent. The web archive is not reliable and often drops mails. > + * Copied off OpenBSD (original is arc4random_uniform) > +

[hackers] Re: [sbase] Orphan patches and unsent patches

2024-03-02 Thread Elie Le Vaillant
Elie Le Vaillant wrote: > cron(1) depends on the shuf(1) patch for libutil/random. This was > not made a standalone patch, which was a mistake on my part. Actually, libutil/random _was_ made a standalone patch, but it appears not to have been sent either. Also I'm not sure whether or not the

[hackers] [sbase] Orphan patches and unsent patches

2024-03-02 Thread Elie Le Vaillant
Hello, Some patches I've sent are orphaned in the mailing list. These are: > strptime: tm should be initialized as the current time and > shuf: use libutil/random functions instead of custom ones Moreover, some patches I believed to have sent, weren't actually sent, due to bugs of my mail

[hackers] [sbase][PATCH] Add implementation of shuf(1)

2024-03-02 Thread Elie Le Vaillant
--- .gitignore | 1 + Makefile | 2 ++ README | 1 + libutil/random.c | 46 + shuf.1 | 43 +++ shuf.c | 77 util.h | 3 ++ 7 files

[hackers] [sbase][PATCH] Add implementation of tac(1)

2024-03-02 Thread Elie Le Vaillant
--- .gitignore | 1 + Makefile | 1 + README | 1 + libutil/getlines.c | 3 +- tac.1 | 22 +++ tac.c | 68 ++ text.h | 3 +- 7 files changed, 97 insertions(+), 2

[hackers] [sbase][PATCH] Add strptime, which replaces date-parsing in date(1)

2024-03-02 Thread Elie Le Vaillant
usage: strptime timestamp fmt Most other userspace implementations allow in date(1) the parsing of dates. That way, one can use a date string, and manipulate it in scripts. However, the current date(1) implementation only accepts Unix epochs to describe date and time. Rather than patching

[hackers] [sbase] sed.1: add some missing info

2024-02-29 Thread Andrea Calligaris
There are some features that are coded already, might as well document them. --- sed.1 | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sed.1 b/sed.1 index 962370e..8b3fe06 100644 --- a/sed.1 +++ b/sed.1 @@ -50,16 +50,32 @@ Append the commands from to

[hackers] [sbase][PATCH] strptime: tm should be initialized as the current time

2024-02-29 Thread Elie Le Vaillant
localtime() provides the necessary informations to make mktime() work even in the absence of most informations. That way, strptime "%d/%m" 26/08 outputs a timestamp corresponding to the 26th of August of the current year, rather than the 1st January of 1900. --- strptime.c | 15 ---

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

2024-02-28 Thread 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 the current context. This makes

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

2024-02-28 Thread 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 the current context. This makes

Re: [hackers] Penfing patches for sbase and ubase

2024-02-27 Thread Elie Le Vaillant
"Roberto E. Vargas Caballero" wrote: > I know that there are some pending patches for sbase and ubase, > but I am a bit busy these days and I will not be able to look > a bit deeper on them until next week. Be patient until then :) > > Thank you Sure, no problem! I've sent most of the patches

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

2024-02-27 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

[hackers] [sbase][PATCH] shuf: use libutil/random functions instead of custom ones

2024-02-27 Thread Elie Le Vaillant
--- shuf.c | 37 + 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/shuf.c b/shuf.c index 2655d08..3d8ec51 100644 --- a/shuf.c +++ b/shuf.c @@ -7,41 +7,6 @@ #include "text.h" #include "util.h" -/* - * Uniformity is achieved by generating new

[hackers] [sbase][PATCH] libutil: add random.c

2024-02-27 Thread Elie Le Vaillant
Some programs need a good PRNG, such as shuf(1), or cron(1). This adds to libutil a random_uniform function which simply solves the problem of creating integers uniformly in a range. random_seed seeds the generator. arc4random would probably be a better PRNG than random, but it is less portable

[hackers] Penfing patches for sbase and ubase

2024-02-26 Thread Roberto E. Vargas Caballero
Hi, I know that there are some pending patches for sbase and ubase, but I am a bit busy these days and I will not be able to look a bit deeper on them until next week. Be patient until then :) Thank you

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

2024-02-26 Thread 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 need to revert the s/\n/\0/

[hackers] [sbase][PATCH] Add implementation of shuf(1)

2024-02-26 Thread Elie Le Vaillant
--- .gitignore | 1 + Makefile | 1 + README | 1 + shuf.1 | 43 + shuf.c | 110 + 5 files changed, 156 insertions(+) create mode 100644 shuf.1 create mode 100644 shuf.c diff --git a/.gitignore

[hackers] [sbase][PATCH] Add implementation of ts(1)

2024-02-26 Thread Elie Le Vaillant
The -m flag is not compliant to either the OpenBSD or the moreutils implementation of ts(1), but closer to the toybox one. It allows the user to add in nanoseconds, like toybox, but allows to specify how many digits are printed. --- .gitignore | 1 + Makefile | 1 + README | 1 + ts.1

[hackers] [sbase][PATCH] Add strptime, which replaces date-parsing in date(1)

2024-02-26 Thread Elie Le Vaillant
usage: strptime fmt timestamp Most other userspace implementations allow in date(1) the parsing of dates. That way, one can use a date string, and manipulate it in scripts. However, the current date(1) implementation only accepts Unix epochs to describe date and time. Rather than patching

[hackers] [sbase][PATCH] Add implementation of tac(1)

2024-02-26 Thread Elie Le Vaillant
--- .gitignore | 1 + Makefile | 1 + README | 1 + libutil/getlines.c | 3 +- tac.1 | 22 +++ tac.c | 68 ++ text.h | 3 +- 7 files changed, 97 insertions(+), 2

Re: [hackers] [st] Fix cursor move with wide glyphs || Quentin Rameau

2024-02-25 Thread Tim Culverhouse
On Sun Feb 25, 2024 at 8:13 AM CST, Quentin Rameau wrote: > Would you have a suggestion about how to handle cursor absolute > position with text position, maybe we need some addition state? I would suggest that cursor position control sequences should always operate on a single-column basis. This

Re: [hackers] [st] Fix cursor move with wide glyphs || Quentin Rameau

2024-02-25 Thread Quentin Rameau
> Hi, Hola k0ga, > > st would always move back 1 column, > > even with wide glyhps (using more than a single column). > > > > The glyph rune is set on its first column, > > and the other ones are to 0, > > so loop until we detect the start of the previous glyph. > >

  1   2   3   4   5   6   7   8   9   10   >