François Ingelrest wrote:

> On 26 December 2013 17:54, Dominique Pellé wrote:
>> You need to:
>>
>> - build vim with -g -O0
>> - make sure vim is not stripped (uncomment #STRIP = /bin/true
>>   in vim/src/Makefile). Or run vim from the vim/src/. directory,
>>   as it is not stripped there.
>> - start vim with gdb:
>>   $ cd vim/src
>>   $ gdb ./vim
>>   (gdb) run
>>   ... and when it crashes...
>>   (gdb) backtrace
>
> Vim doesn't crash when compiled with -g -O0 so I don't get a stack
> trace, although it's impossible to edit the buffer as Lech said.
>
>> $ cd vim/src
>> $ valgrind --log-file=valgrind.log \
>>    --track-origins=yes \
>>    --num-callers=50 ./vim
>
> Attached is the Valgrind log.

Salut François

I still cannot reproduce the bug somehow. Maybe it depends
on some settings in your ~/.vimrc.  Nevertheless, the error
you find with valgrind is useful:

==29719== Memcheck, a memory error detector
==29719== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==29719== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==29719== Command: ./vim
==29719== Parent PID: 29274
==29719==
==29719== Invalid free() / delete / delete[] / realloc()
==29719==    at 0x4C27D4E: free (vg_replace_malloc.c:427)
==29719==    by 0x4CEC94: vim_free (misc2.c:1744)
==29719==    by 0x46AB3B: post_chdir (ex_docmd.c:8230)
==29719==    by 0x46AD5F: ex_cd (ex_docmd.c:8324)
==29719==    by 0x461B8D: do_one_cmd (ex_docmd.c:2695)
==29719==    by 0x45F20C: do_cmdline (ex_docmd.c:1127)
==29719==    by 0x48B9AC: apply_autocmds_group (fileio.c:9511)
==29719==    by 0x48B25D: apply_autocmds_retval (fileio.c:9130)
==29719==    by 0x4048A4: open_buffer (buffer.c:266)
==29719==    by 0x451E35: do_ecmd (ex_cmds.c:3717)
==29719==    by 0x46A484: do_exedit (ex_docmd.c:7923)
==29719==    by 0x46A141: ex_edit (ex_docmd.c:7819)
==29719==    by 0x461B8D: do_one_cmd (ex_docmd.c:2695)
==29719==    by 0x45F20C: do_cmdline (ex_docmd.c:1127)
==29719==    by 0x44677F: ex_execute (eval.c:21116)
==29719==    by 0x461B8D: do_one_cmd (ex_docmd.c:2695)
==29719==    by 0x45F20C: do_cmdline (ex_docmd.c:1127)
==29719==    by 0x449E82: call_user_func (eval.c:22886)
==29719==    by 0x433F2A: call_func (eval.c:8507)
==29719==    by 0x433B3D: get_func_tv (eval.c:8349)
==29719==    by 0x42F50E: eval7 (eval.c:5158)
==29719==    by 0x42ED88: eval6 (eval.c:4810)
==29719==    by 0x42E952: eval5 (eval.c:4626)
==29719==    by 0x42DEC9: eval4 (eval.c:4319)
==29719==    by 0x42DD25: eval3 (eval.c:4231)
==29719==    by 0x42DBA4: eval2 (eval.c:4160)
==29719==    by 0x42D9E3: eval1 (eval.c:4085)
==29719==    by 0x433AA1: get_func_tv (eval.c:8334)
==29719==    by 0x42C937: ex_call (eval.c:3465)
==29719==    by 0x461B8D: do_one_cmd (ex_docmd.c:2695)
==29719==    by 0x45F20C: do_cmdline (ex_docmd.c:1127)
==29719==    by 0x4E59DE: nv_colon (normal.c:5459)
==29719==    by 0x4DF014: normal_cmd (normal.c:1197)
==29719==    by 0x5B054B: main_loop (main.c:1329)
==29719==    by 0x5AFF79: main (main.c:1020)
==29719==  Address 0x6b1d410 is not stack'd, malloc'd or (recently) free'd

Can you try the attached patch?  Since I can't reproduce
the bug, I'm not sure it will fix it.  So please verify that it
fixes the crash and the valgrind error.

By the way, you used valgrind-3.7.0, which is >2 years old.
Latest version is 3.9.0. But it does not really matter here.

Regards
Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
diff -r 2f856c7c1d43 src/ex_docmd.c
--- a/src/ex_docmd.c	Sun Dec 15 10:02:33 2013 +0100
+++ b/src/ex_docmd.c	Fri Dec 27 09:02:55 2013 +0100
@@ -8228,6 +8228,7 @@
     int		local;
 {
     vim_free(curwin->w_localdir);
+    curwin->w_localdir = NULL;
     if (local)
     {
 	/* If still in global directory, need to remember current
@@ -8244,7 +8245,6 @@
 	 * name. */
 	vim_free(globaldir);
 	globaldir = NULL;
-	curwin->w_localdir = NULL;
     }
 
     shorten_fnames(TRUE);
diff -r 2f856c7c1d43 src/window.c
--- a/src/window.c	Sun Dec 15 10:02:33 2013 +0100
+++ b/src/window.c	Fri Dec 27 09:02:55 2013 +0100
@@ -1216,8 +1216,8 @@
     else
 	copy_loclist(oldp, newp);
 #endif
-    if (oldp->w_localdir != NULL)
-	newp->w_localdir = vim_strsave(oldp->w_localdir);
+    newp->w_localdir = (oldp->w_localdir == NULL)
+				    ? NULL : vim_strsave(oldp->w_localdir);
 
     /* copy tagstack and folds */
     for (i = 0; i < oldp->w_tagstacklen; i++)

Raspunde prin e-mail lui