Re: mutt_buffer_concat_path is broken [PATCH: 1/1] Version 2
Matthias Andree via Mutt-dev <[email protected]> Fri, 8 May 2026 20:34:28 +0200
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <[email protected]> |
Am 08.05.26 um 06:57 schrieb Kevin J. McCarthy:
> [...]
> However, the last, simplest version that Alex posted also bears note.
> I'm adding more context lines (breaking the patch) to make the whole
> thing clearer:
>
> 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)
> {
> const char *fmt = "%s/%s";
>
> if (!*fname || (*dir && dir[strlen(dir)-1] == '/'))
> fmt = "%s%s";
>
> + fname += strspn(fname, "/");
> +
> mutt_buffer_printf(d, fmt, dir, fname);
> }
>
> I think this is basically equivalent to what you posted, Rene.
>
> The only tests that were failing in Derek's list where those in which
> fname started with '/'. So it clearly fixes that bug.
>
> Fortunately I don't have to choose. I had forgotten that there is
> another version of the function in lib.c: mutt_concat_path(). It's not
> called, but it should be fixed too. And Alex's one-line fix applies
> easily there.
If it's not called, why not delete it?