Hi Derek, On 2026-05-07T12:19:57-0400, Derek Martin wrote: > On Wed, May 06, 2026 at 11:15:19PM +0200, Alejandro Colomar via Mutt-dev > wrote: > > To be honest, I find the code below completely unreadable. > > That's a fair criticism, I didn't spend enough (any, really) time > trying to simplify the logic. Simplification was definitely possible. > The second version is much clearer, I think. > > FWIW, I found yours no more readable, mostly because the logic was > spread across too many layers.
The actual fix is not spread:
diff --git i/muttlib.c w/muttlib.c
index 59a48378..a9fe8779 100644
--- i/muttlib.c
+++ w/muttlib.c
@@ -1394,6 +1394,8 @@ void mutt_buffer_concat_path(BUFFER *d, const
char *dir, const char *fname)
if (!*fname || (*dir && dir[strlen(dir)-1] == '/'))
fmt = "%s%s";
+ fname += strspn(fname, "/");
+
mutt_buffer_printf(d, fmt, dir, fname);
}
This passes all the tests you've shown (except for the NULL pointer
segfault), and uses a well-known C89 function.
Cheers,
Alex
--
<https://www.alejandro-colomar.es>
signature.asc
Description: PGP signature
