GNU bug report logs -
#75845
mapconcat crashes for unreasonable self-modifications
Previous Next
Full log
View this message in rfc822 format
21 feb. 2025 kl. 13.35 skrev Pip Cet <pipcet <at> protonmail.com>:
> (If we really want to optimize it further, let's get rid of the strange
> double loop in mapconcat first, which spreads the arguments then goes
> back over the list in reverse order to fill in the separators).
I don't think it's really a cache killer but will give it a look.
> I maintain that using strings as a sequence argument to the map*
> functions is so rare we should just turn them into a list or vector
> instead and drop the special-casing code.
I'll think about it.
> I'm still not convinced abolishing string mutation is a good idea,
Let's try to solve this bug in isolation. We're almost done!
> With maphash, this actually happens (it does, or did, in the nativecomp
> code) by accident. I'm not sure the same is true for sequences, where
> "don't crash" is probably the best we can hope for.
Lisp shouldn't crash but it's impractical to be absolute about it. The programming interface is so rich that it's almost impossible to prevent crashes altogether, and performance considerations further reduce what checks we want to perform. For instance, the user can easily crash Emacs by running bad bytecode. But users expect more about basic Lisp primitives like mapcar & co and since it seems that a reasonable effort can prevent it, and it's not (too) expensive, let's try.
Feel free to commit your patch, or post it here if you want us to poke fun at it beforehand.
This bug report was last modified 210 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.