Re: [hackers] [sbase][PATCH] tar: man page update, and more robust & descriptive errors

2025-06-02 Thread Roberto E. Vargas Caballero
Hi On Sun, Jun 01, 2025 at 10:09:11PM +1000, Xan Phung wrote: > 1. Manual page has been updated to reflect previous change to tar. > > 2. Error messages are more detailed & secured against unterminated > header strings. Previously, sanitize() assumed numeric fields were > terminated by space or

Re: [hackers] [PATCH sbase] libutil/unescape: Stop octal escape at 3 digits

2025-05-06 Thread Roberto E. Vargas Caballero
Hi, On Wed, Apr 30, 2025 at 02:13:38PM -0600, Evan Gates wrote: > Unfortunately POSIX specifies that printf(1)'s %b conversion specifier > interprets octal as \0ddd. IIRC that is why unescape uses 4 now. > That should probably be an argument that can be passed in or configurable > in some way so

Re: [hackers] [sbase][PATCH] tar: bug fix and compatibility improvements

2025-05-06 Thread Roberto E. Vargas Caballero
Hi, Applied with a minor whitespace change. Thanks! Regards,

Re: [hackers] [sbase][PATCH] tar: bug fix and compatibility improvements

2025-04-30 Thread Roberto E. Vargas Caballero
Hi, On Tue, Apr 29, 2025 at 10:20:12PM +1000, Xan Phung wrote: > 3. Command line argument compatibility improvements: 'c', 'x', 't' > args are accepted without needing a hyphen in front. The '-p' > flag is also accepted but is no-op (as it is the normal behaviour > of sbase tar anyway, and allows

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-24 Thread Roberto E. Vargas Caballero
Hi, On Wed, Apr 23, 2025 at 05:56:45PM +0200, THIBAUT AUBIN wrote: > P.S: I noticed some of my emails to hackers_AT_suckless.org are > rejected with SMTP 451. Several people noticed me with the same problem. I don't know what it is happening, Evil_Bob, Quinq, maybe we should take a look to the su

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-23 Thread Roberto E. Vargas Caballero
Hi, On Wed, Apr 23, 2025 at 01:08:00PM +0200, THIBAUT AUBIN wrote: > Regarding in "util.h", this was omitted in accordance to ISO/IEC > 9899:1999 (C99) §7.19.6.8. > A conforming C library must provide the v-printf family (e.g: `vfprintf`, > `vprintf`, `vsprintf`, `vsnprintf` in , so on most platf

Re: [hackers] [sbase] cp: add -i flag || Thibaut Aubin

2025-04-20 Thread Roberto E. Vargas Caballero
Hi, ` On Sun, Apr 20, 2025 at 07:47:49AM +, NRK wrote: > On Sun, Apr 20, 2025 at 09:22:10AM +0200, g...@suckless.org wrote: > > + if (!confirm("overwrite '%s'? ", s2)) { > > + cp_status = 1; > > I missed it when reviewing the fist time, but this, I'm pretty sure is

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-20 Thread Roberto E. Vargas Caballero
On Sun, Apr 20, 2025 at 01:25:33AM +0200, THIBAUT AUBIN wrote: > Thank you Quentin for raising the POSIX issue. > > I corrected the code to address this, the behavior is now: > ^[yY] -> affirmative > ^[^yY] -> negative > e.g: cp -i: If the response from the standard input is affirmative, the > co

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-20 Thread Roberto E. Vargas Caballero
Hi, On Sat, Apr 19, 2025 at 11:25:15AM +, NRK wrote: > At a glance this looks okay, aside from what Quentin mentioned about > POSIX disallowing trimming leading chars. > > Also it seems like your mail client is messing up the indentation. It's > better to just attach the patch as a file. But

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-19 Thread Roberto E. Vargas Caballero
Hi, On Sat, Apr 19, 2025 at 12:37:35PM +0200, Quentin Rameau wrote: > - It happens to me that I typo things in that context like "uyes", > resulting here in a negative answer. > That's on me, but that's pretty annoying. > > It would be nice to check if the answer is either clear positive, > or cl

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-19 Thread Roberto E. Vargas Caballero
Hi, On Sat, Apr 19, 2025 at 11:20:48AM +, NRK wrote: > It does still allow discarding trailing chars, right? Since "yes" > matches "^[yY]". > > (Also, does sbase deal with the whole locale mess?) No, and it means that we have to use the default locale that is the C locale, that in the case o

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-19 Thread Roberto E. Vargas Caballero
On Sat, Apr 19, 2025 at 11:20:48AM +, NRK wrote: > On Sat, Apr 19, 2025 at 12:37:35PM +0200, Quentin Rameau wrote: > This I'm fairly certain isn't allowed, we need to read a *single line* > not "discard what's there and then read a line". > Also, the line may not be coming from a tty either: A

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-18 Thread Roberto E. Vargas Caballero
Hi, On Thu, Apr 17, 2025 at 09:44:31PM +, NRK wrote: > A couple facts: > > 1. POSIX requires a single whole line to be read (as Roberto pointed out >already). > 2. POSIX doesn't define what "affirmative" response is. >GNU Coreutils reads the first char and discards the rest [0]. >

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-17 Thread Roberto E. Vargas Caballero
Hi, On Thu, Apr 17, 2025 at 01:32:55PM +0200, THIBAUT AUBIN wrote: > I respectfully disagree with Roberto Vargas. > NRK suggested approach is consistent with the behavior of GNU coreutils > 8.30. Well, disagree is a good thing, and I would like more constructive discussion in the mailing list, bu

Re: [hackers] [sbase][PATCH] cp: add -i flag

2025-04-16 Thread Roberto E. Vargas Caballero
Hi, On Wed, Apr 16, 2025 at 12:06:25PM +, NRK wrote: > The whole line needs to be read, even when the first char is `y|Y`. > Also, getchar may return EOF before newline leading to an infinite loop. > Suggestion (untested): > > int ans = getchar(); > for (int c = ans; c != '\

Re: [hackers] [surf] Maintenance status?

2025-04-12 Thread Roberto E. Vargas Caballero
Hi, On Thu, Apr 10, 2025 at 10:05:19PM +0400, Artyom Bologov wrote: > I've noticed that Surf had no commits for the last year and my patch was > left unanswered by the maintainer(s?) Not that I complain—my patch was a > controversial PDF support one. The current maintainer is Quentin Rameau, and

Re: [hackers] [sbase][PATCH] du: Dedup hardlinks

2025-04-12 Thread Roberto E. Vargas Caballero
Hi, On Thu, Apr 10, 2025 at 04:33:05PM +0100, l...@disroot.org wrote: > For instance, if there are many cached inodes from one device and du is > searching for an inode from another device. But I am prematurely optimising. > The changes look all good to me Uh, it was just a patitioning idea.

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

2025-03-21 Thread Roberto E . Vargas Caballero
Hi, Applied (again). I will push it once the open discussions about the other patches are closed. Thank you,

Re: [hackers] [sbase][PATCH] du: Dedup hardlinks

2025-03-20 Thread Roberto E . Vargas Caballero
Hi, Quoth Roberto E. Vargas Caballero : > Quoth remph : > > +struct device { > > + dev_t devno; > > + void * inodetree; > > +}; > > + > > I can see that you define a device struct, that contains a inode > table, but I think it is just easier to cr

Re: [hackers][sbase][PATCH] Add sbase-box to gitignore

2025-03-19 Thread Roberto E . Vargas Caballero
Hi, Quoth sebastien peterson boudreau : > From: sebastien peterson boudreau > To: hackers@suckless.org > Cc: sebastien.peterson.boudr...@gmail.com > Date: Tue Mar 11 08:47:22 +0100 2025 > Subject: [hackers][sbase][PATCH] Add sbase-box to gitignore > > From: Sebastien Peterson-Boudreau > A

Re: [hackers] [sbase][PATCH] du: Dedup hardlinks

2025-03-19 Thread Roberto E . Vargas Caballero
Hi, Quoth remph : > +struct device { > + dev_t devno; > + void * inodetree; > +}; > + I can see that you define a device struct, that contains a inode table, but I think it is just easier to create a struct like: struct file { dev_t dev; ino_t inod

Re: [hackers] [sbase][PATCH] tar: archive: improve fix for long names crashing

2025-03-18 Thread Roberto E . Vargas Caballero
Hi, Quoth Roberto E. Vargas Caballero : > I propose these changes to your patch (not tested yet): In fact, my changes were wrong too. At the end I considered that was worth to use memcpy and avoid the temporary buffer and deal manually with the multiple slashes at the end of the dirname. T

Re: [hackers] [sbase][PATCH 2/6] find: Don't exit successfully after errors

2025-03-17 Thread Roberto E . Vargas Caballero
Hi, This seems ok to me. Unless someone complains I will apply it. Regards,

Re: [hackers] [sbase][PATCH 4/6] find: Use the current umask to parse -perm

2025-03-17 Thread Roberto E. Vargas Caballero
Hi, On Mon, Mar 17, 2025 at 08:08:51AM -0400, Tavian Barnes wrote: > On Mon, Mar 17, 2025 at 7:14 AM Roberto E. Vargas Caballero > > I don't think this is correct. The results of -perm should not depend > > of the process umask. Why do you think -perm should use umask(2)?

Re: [hackers] [sbase][PATCH 5/6] libutil/mode: Fix sticky bit parsing

2025-03-17 Thread Roberto E . Vargas Caballero
Hi, Quoth Tavian Barnes : > --- > @@ -40,10 +40,10 @@ next: > who |= S_IRWXG|S_ISGID; > continue; > case 'o': > - who |= S_IRWXO; > + who |= S_IRWXO|S_ISVTX; > continue; >

Re: [hackers] Re: [sbase][PATCH 6/6] find: Implement -print0

2025-03-17 Thread Roberto E . Vargas Caballero
Hi, Quoth Tavian Barnes : > On Fri, Feb 14, 2025 at 11:25 AM Tavian Barnes > > +static int > > +pri_print0(struct arg *arg) > > +{ > > + if (fwrite(arg->path, strlen(arg->path) + 1, 1, stdout) != 1) > > + eprintf("fwrite failed:"); > > + return 1; > > +} > > + I noticed

Re: [hackers] [sbase][PATCH 4/6] find: Use the current umask to parse -perm

2025-03-17 Thread Roberto E . Vargas Caballero
Hi, Quoth Tavian Barnes : > --- > @@ -524,7 +525,10 @@ get_perm_arg(char *argv[], union extra *extra) > else > p->exact = 1; > > - p->mode = parsemode(*argv, 0, 0); > + mask = umask(0); > + umask(mask); > + > + p->mode = parsemode(*argv, 0, mask); > >

Re: [hackers] [sbase][PATCH 3/6] find: Fix spawn() return value

2025-03-17 Thread Roberto E . Vargas Caballero
Hi, Quoth Evan Gates : > On Fri, 14 Feb 2025 at 09:25 Tavian Barnes, wrote: > > > --- > > find.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/find.c b/find.c > > index ce551e5..71488da 100644 > > --- a/find.c > > +++ b/find.c > > @@ -244,6 +244,7 @@ spawn(ch

Re: [hackers] [sbase][PATCH 1/6] find: Fall back from stat() to lstat() on broken links

2025-03-17 Thread Roberto E . Vargas Caballero
Quoth Tavian Barnes : > --- > +static int > +do_stat(char *path, struct stat *sb, struct findhist *hist) > +{ > + if (gflags.l || (gflags.h && !hist)) { > + if (stat(path, sb) == 0) { > + return 0; > + } else if (errno != ENOENT && errno != ENOTDIR) {

Re: [hackers][sbase][PATCH] Update Makefile to use POSIX shell substitution

2025-03-14 Thread Roberto E . Vargas Caballero
Hi, Quoth Sebastien Peterson-Boudreau : > On Thu, Mar 13, 2025 at 10:50:36PM +0100, Страхиња Радић wrote: > > IMHO the latest additions to POSIX are nonportable to programs and > > systems using an earlier versions of the standard, > This is a very good point and I would readily accept it as a ref

Re: [hackers] [st][PATCH] Do not interpret CSI ? u as DECRC

2025-01-30 Thread Roberto E. Vargas Caballero
Hi, On Thu, Jan 30, 2025 at 09:54:38AM +0100, Roberto E. Vargas Caballero wrote: > I personally think we should remove that, as the only way to get > the correct output is checking the terminfo entry using the TERM > variable, and as we didn't care anymore about ansy.sys is likely

Re: [hackers] [st][PATCH] Do not interpret CSI ? u as DECRC

2025-01-30 Thread Roberto E. Vargas Caballero
Hi, On Sun, Jan 26, 2025 at 01:40:57PM +0100, Johannes Altmanninger wrote: > The kitty keyboard protocol docs recommend CSI ? u to query support for > that protocol, see https://sw.kovidgoyal.net/kitty/keyboard-protocol/ > > For better or worse, fish shell uses this query to work around bugs > in

Re: [hackers] [PATCH] libutil/random: fix conflict between versions

2024-12-20 Thread Roberto E . Vargas Caballero
Quoth Elie Le Vaillant : > --- > libutil/random.c | 23 +++ > 1 file changed, 11 insertions(+), 12 deletions(-) > > diff --git a/libutil/random.c b/libutil/random.c > index 72385fb..15082e5 100644 Did you read my other mail about considering if we actually need these functio

Re: [hackers] [PATCH] libutil/random: fix conflict between versions

2024-12-20 Thread Roberto E . Vargas Caballero
Quoth Elie Le Vaillant : > --- > libutil/random.c | 23 +++ > 1 file changed, 11 insertions(+), 12 deletions(-) > > diff --git a/libutil/random.c b/libutil/random.c > index 72385fb..15082e5 100644 > --- a/libutil/random.c > +++ b/libutil/random.c > @@ -21,7 +21,7 @@ rng32(void

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][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

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] 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

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][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

Re: [hackers] [sbase][PATCH] kill: handle TRAP signal

2024-12-17 Thread Roberto E. Vargas Caballero
Hi, On Mon, Dec 09, 2024 at 06:36:07AM -0700, Randy Palamar wrote: > TRAP is a useful signal which when sent to a process currently > attached to a debugger causes the debugger to immediately break. > This is very helpful for programs running in some sort of run loop > where it may be difficult to

Re: [hackers] [sbase][PATCH] tar: fix problem with paths longer than 100 characters

2024-12-17 Thread Roberto E. Vargas Caballero
Hi, On Sat, Dec 07, 2024 at 10:53:03AM +0100, Страхиња Радић wrote: > Related: > > https://lists.suckless.org/dev/2207/34907.html > https://lists.suckless.org/dev/2208/34908.html I applied the original patch 'tar: fix problem with paths longer than 100 characters' and I am going to take a take

Re: [hackers] [st][PATCH] Clear screen: Fix edge case

2024-11-27 Thread Roberto E. Vargas Caballero
Hi, On Mon, Nov 25, 2024 at 01:31:56PM +0200, Markus Rinne wrote: > With sequence \e[1J, if cursor is on second line, clear the first line. > --- > st.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/st.c b/st.c > index 57c6e96..2e3800e 100644 > --- a/st.c > +++ b/st.c

Re: [hackers] [sbase][PATCH] README: Add usage instruction for sbase-box. Fix typos.

2024-10-07 Thread Roberto E. Vargas Caballero
On Fri, Sep 13, 2024 at 05:20:31AM +, Brandon Pribula wrote: > Hello, > > I thought it would be a good idea to add a usage instruction for sbase-box in > sbase's README similar to the one in ubase's README. > > Also, I found a couple of minor typos that I thought I would fix. There's no > c

Re: [hackers] [sbase][PATCH] fix: update man pages to standard mdoc date format

2024-09-07 Thread Roberto E. Vargas Caballero
Hi, On Sat, Sep 07, 2024 at 10:57:31PM +, Brandon Pribula wrote: > Hello, > > When viewing sbase's man pages the date displayed at the bottom is the > current date rather than the date entered in the .1 file. > > According to this: > > https://mandoc.bsd.lv/mdoc/details/date.html > > The

Re: [hackers] [st][PATCH] fix BadMatch error when embedding on some windows

2024-08-08 Thread Roberto E. Vargas Caballero
Hi, On Wed, Aug 07, 2024 at 11:55:59PM -0300, Lucas de Sena wrote: > When embedded, st fails with BadMatch error if the embedder's window has > non-default colormap/depth/visual. This commit fixes that by creating > st's window inside root and then reparent it into embedder. > > The reference wi

Re: [hackers] [st][PATCH] remove secondary call to select

2024-07-03 Thread Roberto E. Vargas Caballero
Hi, On Sat, Jun 29, 2024 at 12:21:51PM +0200, Hiltjo Posthuma wrote: > Hi Jeremy, > > Thanks for the updated patch and example. > > The example below doesn't seem to deadlock for me however. > > More eyes and review would be appreciated, If my memory does not betrayes me I think this was the p

Re: [hackers] [st][PATCH] remove secondary call to select

2024-06-28 Thread Roberto E. Vargas Caballero
Hi, On Thu, Jun 27, 2024 at 06:51:28PM -0700, Jeremy Bobbin wrote: > because underlying programs can request info from the tty, there was a > potential recursion in ttyread: > 1. ttyread > 2. tty program wants window size > 3. ttywrite the window size > > this assumes the ttyfd

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] [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. Saying

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!

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 reb

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) > g

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 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 re

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++) > > -

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++) >

[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

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

2024-02-25 Thread Roberto E. Vargas Caballero
Hi, On Sun, Feb 25, 2024 at 11:57:03AM +0100, g...@suckless.org wrote: > 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 t

Re: [hackers] [sbase][PATCH] expr: tonum: handle case where result was previously calculated

2024-01-30 Thread Roberto E. Vargas Caballero
Hi, On Mon, Jan 22, 2024 at 02:18:10PM -0700, Randy Palamar wrote: > As pointed out in a mail to dev expr was segfaulting when multiple > math operations were specified on the command line: eg. 'expr 3 \* > 2 + 1'. This happens because the tonum(), introduced in e50d533, > assumed that v->str was

Re: [hackers] [sbase][PATCH 2/2] expr: don't evaluate matched substr as a number

2024-01-16 Thread Roberto E. Vargas Caballero
Hi, On Sun, Jan 07, 2024 at 11:02:18AM -0700, Randy Palamar wrote: > POSIX specifies that if the pattern contains a subexpression then > the first matched subexpression should be returned if it exists. > > This fixes things like the following: > > ./expr 3 : '\(.*\)' > Before: 3 > After: 000

Re: [hackers] [sbase][PATCH 1/2] expr: treat expressions as strs until evaluation

2024-01-16 Thread Roberto E. Vargas Caballero
Hi On Sun, Jan 07, 2024 at 11:02:17AM -0700, Randy Palamar wrote: > Comparison operations (>, <, =, etc.) and matching operations must > operate originally provided string not one that has gone back and > forth through string formatting. This caused operations such as > the following to give incor

[hackers] [PATCH 5/6] ed: Simplify sighup dealing

2023-12-28 Thread Roberto E. Vargas Caballero
As we already have the dump() function we can move the modification check inside the new dump() function. --- ed.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index eaa4ca9..0705beb 100644 --- a/ed.c +++ b/ed.c @@ -710,6 +710,9 @@ dump(void) { cha

[hackers] [PATCH 6/6] ed: Don't undo commands in sigint

2023-12-28 Thread Roberto E. Vargas Caballero
If newcmd is 0 then error() undo all the modifications that happened since the last command, but this is not what POSIX mandates: SIGINT The ed utility shall interrupt its current activity, write the string "?\n" to standard output, and return to command mode (see the EXTENDED DE

[hackers] [PATCH 2/6] ed: Remove nothing comments

2023-12-28 Thread Roberto E. Vargas Caballero
Several bugs happened in the past due to this kind of comments and it is better to get rid of them. --- ed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index b6f4f1c..b94afa5 100644 --- a/ed.c +++ b/ed.c @@ -199,7 +199,7 @@ makeline(char *s, int *off)

[hackers] [PATCH 3/6] ed: Fix G and V commands

2023-12-28 Thread Roberto E. Vargas Caballero
--- ed.c | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/ed.c b/ed.c index b94afa5..35fddf1 100644 --- a/ed.c +++ b/ed.c @@ -1242,7 +1242,6 @@ repeat: trunc = pflag = 0; switch (cmd) { case '&': - /* This is

[hackers] [PATCH 4/6] ed: Print only last line in empty command

2023-12-28 Thread Roberto E. Vargas Caballero
--- ed.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ed.c b/ed.c index 35fddf1..eaa4ca9 100644 --- a/ed.c +++ b/ed.c @@ -1255,6 +1255,7 @@ repeat: case '\0': num = gflag ? curln : curln+1; deflines(num, num); + line1 = line2;

[hackers] [PATCH 1/6] ed: Fix makeline

2023-12-28 Thread Roberto E. Vargas Caballero
Strings without newlines created problems in the function and the global field was not updated, making that new lines added were marked as global being processed in the current global command. --- ed.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index a8bc7

[hackers] [PATCH 0/6] Fix global commands and signal improvements

2023-12-28 Thread Roberto E. Vargas Caballero
This patch serie fixes several problems related to how global commands are managed, fixing G and V commands, and it also adds several small improvements in how signals are handled. Roberto E. Vargas Caballero (6): ed: Fix makeline ed: Remove nothing comments ed: Fix G and V commands ed

Re: [hackers] ed: Enable multi line commands

2023-12-28 Thread Roberto E. Vargas Caballero
Hi, On Sun, Dec 24, 2023 at 12:07:44PM +0100, Rene Kita wrote: > On Wed, Dec 13, 2023 at 12:55:26PM +0100, Roberto E. Vargas Caballero wrote: > > It changes to read full lines before executing commands, escaping > > newlines when it is needed. It solves 2

Re: [hackers] [PATCH 1/6] ed: Add optional parameter to string()

2023-12-28 Thread Roberto E. Vargas Caballero
Hi, On Tue, Dec 26, 2023 at 03:40:36PM +0100, Страхиња Радић wrote: > On 23/12/24 11:46AM, Rene Kita wrote: > > > + if (!from) { > > > + len = 0; > > > + t = NULL; > > > + } else { > > This seems redundant. Normally, NULL shouldn't be passed, and even if it is, > it > is the res

Re: [hackers] [PATCH 1/6] ed: Add optional parameter to string()

2023-12-28 Thread Roberto E. Vargas Caballero
Hi, On Sun, Dec 24, 2023 at 11:46:26AM +0100, Rene Kita wrote: > Nit as it's more a matter of style: I'd prefer to have one function to > create a String and another function to create a String from a char > array. This would make a cleaner interface and avoids passing and > dealing with NULL all

[hackers] [PATCH 6/6] ed: Update TODO

2023-12-13 Thread Roberto E. Vargas Caballero
Remove the cases are tested to work correctly now. --- TODO | 16 1 file changed, 16 deletions(-) diff --git a/TODO b/TODO index a78cf8b..000fd06 100644 --- a/TODO +++ b/TODO @@ -28,10 +28,6 @@ Bugs ed -- -* Multi-line commands don't work in global commands: -g/^line/a \

[hackers] [PATCH 5/6] ed: Improve execsh

2023-12-13 Thread Roberto E. Vargas Caballero
--- ed.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index 16fbe04..60673a2 100644 --- a/ed.c +++ b/ed.c @@ -1061,13 +1061,21 @@ execsh(void) } while ((c = input()) != '\0') { - if (c == '%' && (cmd.siz == 0 || cmd.s

[hackers] [PATCH 4/6] ed: Avoid dangling pointer in getrhs()

2023-12-13 Thread Roberto E. Vargas Caballero
If the string r.str is freed but error() is called then next call will see a pointer that maybe it will try to free because the call to error unwind the frame stack. --- ed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ed.c b/ed.c index ad6c81a..16fbe04 100644 --- a/ed.c ++

[hackers] [PATCH 2/6] ed: Add getinput() and setinput()

2023-12-13 Thread Roberto E. Vargas Caballero
These functions allow to read from stdin the full next line or seting as input a character array. These functions avoid all the complexity about repeat commands that is very fragile and depends on having multiple global variables with weak relation between them. --- ed.c | 171

[hackers] [PATCH 3/6] ed: Read from input in append()

2023-12-13 Thread Roberto E. Vargas Caballero
This enables using a and i commands in a global command because the input is not anymore taken from stdin. --- ed.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/ed.c b/ed.c index 7881fba..ad6c81a 100644 --- a/ed.c +++ b/ed.c @@ -686,6 +686,15

[hackers] [PATCH 1/6] ed: Add optional parameter to string()

2023-12-13 Thread Roberto E. Vargas Caballero
This makes possible to use the function to initialize the string from an existing char array. --- ed.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/ed.c b/ed.c index b430e74..13e956a 100644 --- a/ed.c +++ b/ed.c @@ -122,12 +122,24 @@ prevln(in

[hackers] ed: Enable multi line commands

2023-12-13 Thread Roberto E. Vargas Caballero
It changes to read full lines before executing commands, escaping newlines when it is needed. It solves 2 different cases: - Substitution commands with newlines in the replace part - Global commands with append or insert commands Still, some additional problems were detected in th

Re: [hackers] [sbase] sbase-box: Fix segmentation fault when exe without args

2023-12-05 Thread Roberto E. Vargas Caballero
Hi, On Fri, Dec 01, 2023 at 01:33:36PM +0100, Jules Maselbas wrote: > when sbase-box is executed without argument, the check sbase-box > options doesn't verify the argument count leading to a segfault. > > Add a check on the argc before parsing sbase-box options (currently > only `-i`) Applied,

Re: [hackers] [sbase][PATCH] ed: Allow newlines in a Substitute Command

2023-12-05 Thread Roberto E. Vargas Caballero
Hi, On Wed, Nov 15, 2023 at 08:56:56AM +0100, Rene Kita wrote: > > I think the way to fix this problem is reading the full command before > > executing it, otherwise there are so many traps. I am going to try to > > fix this in th enext days. > > I had the same idea. Reading the full command will

Re: [hackers] [sbase][PATCH] ed: Allow newlines in a Substitute Command

2023-11-14 Thread Roberto E. Vargas Caballero
Hi, On Sun, Nov 05, 2023 at 02:38:20PM +0100, Rene Kita wrote: > On Fri, Nov 03, 2023 at 01:32:37PM +0100, Rene Kita wrote: > > borked patch > > Patch is not sufficient, sorry for the noise. I have this problem in my radar. I began to write a solution for it, but I had to switch to implement bc(

Re: [hackers] [sbase] TODO: add replacement bug reported for ed || Hiltjo Posthuma

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH] find: Make parameter error messages more specific

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH 2/2] scripts: Fix non-portable find -perm /mode

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH 1/2] scripts: Fix non-portable usage of find -maxdepth

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH] scripts: Force file copying on install

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH] make: fix rogue parameter in install target

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [sbase][PATCH] Ensure commands are followed by a blank

2023-09-26 Thread Roberto E. Vargas Caballero
Applied.

Re: [hackers] [sbase][PATCH] xargs: implement -I flag

2023-09-22 Thread Roberto E. Vargas Caballero
Hi, On Sun, Jul 30, 2023 at 10:15:49AM +0300, sewn wrote: > From 9f4be567ff25fee986976c6afa193223496013a6 Mon Sep 17 00:00:00 2001 > From: sewn > Date: Fri, 28 Jul 2023 18:58:37 +0300 > Subject: [PATCH] xargs: add replace string flag (-I) I have applied the patch with some small modifications th

Re: [hackers] [ubase][PATCH] Explicitly include sys/sysmacros.h for makedev etc

2023-09-21 Thread Roberto E. Vargas Caballero
On Sun, Aug 06, 2023 at 03:03:21PM +0200, Markus Rudy wrote: > This header used to be included by sys/types.h in glibc, and musl > adopted the behaviour. However, this dependency was never desired, so > glibc deprecated it in 2016 and finally removed it in 2019, and so Applied.

Re: [hackers] [sbase][PATCH] tr: fix behavior of cflag when using character classes

2023-09-21 Thread Roberto E. Vargas Caballero
Hi, On Sun, Aug 06, 2023 at 10:50:25PM +0200, noneofyourbusin...@danwin1210.de wrote: > a simple test case: > > printf ab3 | tr -c '[:alpha:]' '\n' Applied.

Re: [hackers] [st][PATCH] Add support for DSR response "OK" escape sequence

2023-02-07 Thread Roberto E. Vargas Caballero
On Tue, Feb 07, 2023 at 10:54:57AM -0500, Adam Price wrote: > On Mon, Feb 6, 2023 at 12:06 PM Roberto E. Vargas Caballero > wrote: > > > > Hi, > > > > On Mon, Feb 06, 2023 at 08:45:27AM +0200, Santtu Lakkala wrote: > > > >

Re: [hackers] [st][PATCH] Add support for DSR response "OK" escape sequence

2023-02-06 Thread Roberto E. Vargas Caballero
Hi, On Mon, Feb 06, 2023 at 08:45:27AM +0200, Santtu Lakkala wrote: > > tsetattr(csiescseq.arg, csiescseq.narg); > > break; > > - case 'n': /* DSR – Device Status Report (cursor position) */ > > - if (csiescseq.arg[0] == 6) { > > + case 'n': /* DSR – Device St

Re: [hackers] [sbase] [PATCH] Use ar(1)'s s-flag instead of invoking ranlib(1)

2022-08-01 Thread Roberto E. Vargas Caballero
Hi, On Sun, Jul 31, 2022 at 01:00:25AM +0200, Laslo Hunhold wrote: > why would it reduce the portability of the Makefiles? It can be > expected that all ar-implementations support the s-flag, and ranlib is > simply legacy. Because then you will support only the last systems. If you keep the ranli

Re: [hackers] [dwm] Revert "do not call signal-unsafe function inside sighanlder" || Hiltjo Posthuma

2022-07-26 Thread Roberto E. Vargas Caballero
Hi, > > void > > sigchld(int unused) > > { > > + if (signal(SIGCHLD, sigchld) == SIG_ERR) > > + die("can't install SIGCHLD handler:"); > > while (0 < waitpid(-1, NULL, WNOHANG)); > > } > > Calling `die` inside a signhandler is still an issue and can produce > bad behavior (I h

Re: [hackers] [dwm][PATCH] do not call signal-unsafe function inside sighanlder

2022-07-22 Thread Roberto E. Vargas Caballero
Hi, > > Do you have a reference of a description of this behaviour in an other > > system, > > specification or standard? > > > > C89 (7.7.1.1), C99 (7.14.1.1), POSIX 2001 and 2008 all say that "the > equivalent of signal(sig, SIG_DFL)" may be executed prior to executing > the signal handler (b

Re: [hackers] [sbase] [PATCH] Use ar(1)'s s-flag instead of invoking ranlib(1)

2022-07-22 Thread Roberto E. Vargas Caballero
I disagree with this change. I think it adds nothing and reduce portability of the Makefiles. Regards,

Re: [hackers] [st][PATCH] update FAQ regarding meta key

2022-04-12 Thread Roberto E. Vargas Caballero
Hi, > just changing $TERM to "st-meta" doesn't enable the meta key, at least > on vim. searching the mailing list, I learned that `tput smm` was needed > to enable 8bit mode[0]. This topic is a bit more complex. St is doing something a bit weird because we are a utf8 terminal, but we don't enco

  1   2   >