I submitted a patch for this issue to Bram a while ago. I should have
posted it here too. Here are the differences in mine:
I found the issue was also already in todo.txt so I included a patch.
I changed the scope of resolve_symlink slightly different. This seems
like a trivial difference.
I originally thought the same as your patch but I think the
preprocessor use on the result of resolve_symlink gets excessive since
we are using it multiple times now. I looked thoroughly and think
avoiding it is rather simple.
Take a look and tell me if you agree, etc. :)
I'm using the web interface and there isn't a way to attach files. I'm
just putting the file into the message, does that work ok?
- Ian Kelling
iank.patch.20.1
Problem: Vim does not find the swap file durring recovery of a
symlinked file.
Solution: Resolve symlinked files.
Files: src/memline.c, runtime/doc/todo.txt
patched against Vim.7.2.002
*** runtime/doc/todo.txt.orig 2008-08-11 11:46:49.000000000 -0700
--- runtime/doc/todo.txt 2008-08-20 08:53:03.000000000 -0700
***************
*** 334,341 ****
modifier key. Need to catch three different sequences. Use K_ZF1,
like
K_ZHOME? (Dickey, 2007 Dec 2)
- Problem finding swap file for recovery. (Gautam Iyer, 2006 May 16)
-
UTF-8: mapping a multi-byte key where the second byte is 0x80
doesn't appear
to work. (Tony Mechelynck, 2007 March 2)
--- 334,339 ----
*** src/memline.c.orig 2008-08-20 09:05:37.000000000 -0700
--- src/memline.c 2008-08-20 09:06:11.000000000 -0700
***************
*** 245,250 ****
--- 245,253 ----
#ifdef FEAT_BYTEOFF
static void ml_updatechunk __ARGS((buf_T *buf, long line, long len,
int updtype));
#endif
+ #ifdef HAVE_READLINK
+ static int resolve_symlink __ARGS((char_u *fname, char_u *buf));
+ #endif
/*
* Open a new memline for "buf".
***************
*** 1390,1395 ****
--- 1393,1401 ----
int i;
char_u *dirp;
char_u *dir_name;
+ #ifdef HAVE_READLINK
+ char_u fname_buf[MAXPATHL];
+ #endif
if (list)
{
***************
*** 1398,1403 ****
--- 1404,1415 ----
msg_putchar('\n');
}
+ #ifdef HAVE_READLINK
+ /* Expand symlink in the file name. */
+ if (resolve_symlink(*fname, fname_buf) == OK)
+ *fname = fname_buf;
+ #endif
+
/*
* Do the loop for every directory in 'directory'.
* First allocate some memory to put the directory name in.
***************
*** 3482,3490 ****
}
}
- #ifdef HAVE_READLINK
- static int resolve_symlink __ARGS((char_u *fname, char_u *buf));
/*
* Resolve a symlink in the last component of a file name.
* Note that f_resolve() does it for every part of the path, we
don't do that
--- 3494,3501 ----
}
}
+ #ifdef HAVE_READLINK
/*
* Resolve a symlink in the last component of a file name.
* Note that f_resolve() does it for every part of the path, we
don't do that
***************
*** 3579,3585 ****
char_u *r, *s;
#ifdef HAVE_READLINK
char_u fname_buf[MAXPATHL];
- char_u *fname_res;
#endif
#if defined(UNIX) || defined(WIN3264) /* Need _very_ long file
names */
--- 3590,3595 ----
***************
*** 3600,3608 ****
/* Expand symlink in the file name, so that we put the swap file
with the
* actual file instead of with the symlink. */
if (resolve_symlink(fname, fname_buf) == OK)
! fname_res = fname_buf;
! else
! fname_res = fname;
#endif
r = buf_modname(
--- 3610,3616 ----
/* Expand symlink in the file name, so that we put the swap file
with the
* actual file instead of with the symlink. */
if (resolve_symlink(fname, fname_buf) == OK)
! fname = fname_buf;
#endif
r = buf_modname(
***************
*** 3615,3625 ****
/* Avoid problems if fname has special chars, eg <Wimp$Scrap>
*/
ffname,
#else
- # ifdef HAVE_READLINK
- fname_res,
- # else
fname,
- # endif
#endif
(char_u *)
#if defined(VMS) || defined(RISCOS)
--- 3623,3629 ----
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---