> Using gdb it turns out that vim is aborting with a segmentation fault. The
> traceback is:
>
> os_win32.c, line 6414: s[len] = NUL;
> ui.c, line 52: mch_write(s, len);
> eval.c, line 6161: ui_write((char_u *)"\r\n", 2, TRUE);
>
> So it appears that mch_write() is attempting to modify a string literal so
> I'm guessing that the literal is in read-only memory. To test this, I
> created a local variable, initialized it to "]r]n" and passed this as the
> first argument. After rebuilding, the problem no longer occurs.
Thank you for figuring that out!
> So, I propose the following patch (forgive the poor GoogleGroups
> formatting):
>
> diff --git a/src/eval.c b/src/eval.c
> index 4dbbc4096..abf9406c9 100644
> --- a/src/eval.c
> +++ b/src/eval.c
> @@ -6157,8 +6157,9 @@ ex_execute(exarg_T *eap)
> }
> else if (eap->cmdidx == CMD_echoconsole)
> {
> + char_u crlf[] = "\r\n";
> ui_write(ga.ga_data, (int)STRLEN(ga.ga_data), TRUE);
> - ui_write((char_u *)"\r\n", 2, TRUE);
> + ui_write(crlf, 2, TRUE);
> }
> else if (eap->cmdidx == CMD_echoerr)
> {
Not writing the NUL when it's already there should catch more cases.
It's too easy to add another ui_write() with a string literal. I'll
make a patch that solves it this way, please check.
--
Statistics say that you can have a baby per month on average:
Just get nine women pregnant.