This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

is this a bug of vim?


hi, 
	When I open a file by ":tag indent" or "g]", vim complains that
"Unable to open swap file, recovery impossible", which is very annoying.
However, if I open a file via ":edit fname" or ":tabedit fname", no error
message will be issued.

My vim version is 7.2 huge. Vim installed from cygwin package by running 
setup.exe has this problem as well as built from source code by myself.

My vim directory is set to be ".,~/tmp,/var/tmp,/tmp", and each disk 
drive is symbolly linked to "cygdrive/xxx". 

After tracing, I found vim try to open ".e:\\lab\\git_lab\\SAMTuner\\vecfile.cpp.swp".
#0  get_file_in_dir (fname=0x100559a0 ".e:\\lab\\git_lab\\SAMTuner\\vecfile.cpp.swp", dname=0x10153a70 ".")
    at memline.c:3667
#1  0x0048c949 in makeswapname (fname=0x10138470 "e:\\lab\\git_lab\\SAMTuner\\vecfile.cpp", 
    ffname=0x10138438 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", buf=0x10114f90, dir_name=0x10153a70 ".")
    at memline.c:3640
#2  0x0048cc6f in findswapname (buf=0x10114f90, dirp=0x22b59c, old_fname=0x0) at memline.c:3844
#3  0x0048d776 in ml_open_file (buf=0x10114f90) at memline.c:553
#4  0x0046673d in readfile (fname=0x10138438 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", 
    sfname=0x10138470 "e:\\lab\\git_lab\\SAMTuner\\vecfile.cpp", from=0, lines_to_skip=0, 
    lines_to_read=2147483647, eap=0x0, flags=1) at fileio.c:670
#5  0x00407a21 in open_buffer (read_stdin=0, eap=0x0) at buffer.c:130
#6  0x0043b5b4 in do_ecmd (fnum=0, ffname=0x10036398 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", 
    sfname=0x1012adf0 "e:\\lab\\git_lab\\SAMTuner\\vecfile.cpp", eap=0x0, newlnum=0, flags=0) at ex_cmds.c:3641
#7  0x0043b9aa in getfile (fnum=0, ffname=0x10036398 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", 
    sfname=0x1012adf0 "e:\\lab\\git_lab\\SAMTuner\\vecfile.cpp", setpm=1, lnum=0, forceit=0) at ex_cmds.c:3056
#8  0x0052458e in do_tag (tag=0x1012cac4 "SaveFile", type=10, count=0, forceit=0, verbose=0) at tag.c:3132
#9  0x0047ba0f in cs_find_common (opt=0x570e26 "g", pat=0x1012cac4 "SaveFile", forceit=0, verbose=0, use_ll=0)
    at if_cscope.c:1160
#10 0x0047c018 in do_cstag (eap=0x22c580) at if_cscope.c:184
#11 0x0044c041 in ex_tag_cmd (eap=0x10153a70, name=0x22c580 "氖\022\020") at ex_docmd.c:9309
#12 0x1012cac0 in ?? ()

The following patch can fix the problem.

--- a/buffer.c
+++ b/buffer.c
@@ -4228,9 +4228,9 @@ fname_expand(buf, ffname, sfname)
 {
     if (*ffname == NULL)	/* if no file name given, nothing to do */
 	return;
+    *ffname = fix_fname(*ffname);   /* expand to full path */
     if (*sfname == NULL)	/* if no short file name given, use ffname */
 	*sfname = *ffname;
-    *ffname = fix_fname(*ffname);   /* expand to full path */
 
 #ifdef FEAT_SHORTCUT
     if (!buf->b_p_bin)

Now, it works.

#0  get_file_in_dir (fname=0x10056c00 "/cygdrive/e/lab/git_lab/SAMTuner/.vecfile.cpp.swp", dname=0x10131440 ".")
    at memline.c:3667
#1  0x0048c959 in makeswapname (fname=0x1003f8a8 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", 
    ffname=0x100571c8 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", buf=0x10147ba8, dir_name=0x10131440 ".")
    at memline.c:3640
#2  0x0048cc7f in findswapname (buf=0x10147ba8, dirp=0x22b59c, old_fname=0x0) at memline.c:3844
#3  0x0048d786 in ml_open_file (buf=0x10147ba8) at memline.c:553
#4  0x0046674d in readfile (fname=0x100571c8 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", 
    sfname=0x1003f8a8 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", from=0, lines_to_skip=0, 
    lines_to_read=2147483647, eap=0x0, flags=1) at fileio.c:670
#5  0x00407a31 in open_buffer (read_stdin=0, eap=0x0) at buffer.c:130
#6  0x0043b5c4 in do_ecmd (fnum=0, ffname=0x10029928 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", 
    sfname=0x10029928 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", eap=0x0, newlnum=0, flags=0)
    at ex_cmds.c:3641
#7  0x0043b9ba in getfile (fnum=0, ffname=0x10029928 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", 
    sfname=0x10029928 "/cygdrive/e/lab/git_lab/SAMTuner/vecfile.cpp", setpm=1, lnum=0, forceit=0)
    at ex_cmds.c:3056
#8  0x0052459e in do_tag (tag=0x1014deb4 "SaveFile", type=10, count=0, forceit=0, verbose=0) at tag.c:3132
#9  0x0047ba1f in cs_find_common (opt=0x570e26 "g", pat=0x1014deb4 "SaveFile", forceit=0, verbose=0, use_ll=0)
    at if_cscope.c:1160
#10 0x0047c028 in do_cstag (eap=0x22c580) at if_cscope.c:184
#11 0x0044c051 in ex_tag_cmd (eap=0x10131440, name=0x22c580 "崔\024\020") at ex_docmd.c:9309
#12 0x1014deb0 in ?? ()

Thanks.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]