Subject: bug#78690: 31.0.50; split string: args out of range with TRIM

From: Michael Heerdegen <[email-masked]>
Date: Fri, 06 Jun 2025 03:53:47 +0200

Eli Zaretskii <[email-masked]> writes:

> It is quite obvious that split-string is not prepared to deal with a
> situation where the argument STRING begins with a match for
> SEPARATORS.  The breakage here happens because the match for
> SEPARATORS at the very beginning of STRING also matches TRIM, but even
> if that is not so, a match for SEPARATORS at the beginning of STRING
> sets THIS-START incorrectly for the first call to push-one inside the
> while-loop.

I read that as "confirmed, a bug".  Ok, thanks for the analysis.

The original use case is in Helm btw, which does a call like this.  I
made the example a bit shorter for this report - in the original issue
the string starts with whitespace, like

  "            -*- lexical-binding: t; -*-"

but as you already mentioned the issue is the same.

Michael.