|
Karsten Hopp |
458a31 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
458a31 |
Subject: Patch 7.2.427
|
|
Karsten Hopp |
458a31 |
Fcc: outbox
|
|
Karsten Hopp |
458a31 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
458a31 |
Mime-Version: 1.0
|
|
Karsten Hopp |
458a31 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
458a31 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
458a31 |
------------
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
Patch 7.2.427
|
|
Karsten Hopp |
458a31 |
Problem: The swapfile is created using the destination of a symlink, but
|
|
Karsten Hopp |
458a31 |
recovery doesn't follow symlinks.
|
|
Karsten Hopp |
458a31 |
Solution: When recovering, resolve symlinks. (James Vega)
|
|
Karsten Hopp |
458a31 |
Files: src/memline.c
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
*** ../vim-7.2.426/src/memline.c 2010-03-10 14:46:21.000000000 +0100
|
|
Karsten Hopp |
458a31 |
--- src/memline.c 2010-05-14 17:28:29.000000000 +0200
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 245,250 ****
|
|
Karsten Hopp |
458a31 |
--- 245,253 ----
|
|
Karsten Hopp |
458a31 |
#ifdef FEAT_BYTEOFF
|
|
Karsten Hopp |
458a31 |
static void ml_updatechunk __ARGS((buf_T *buf, long line, long len, int updtype));
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
+ #ifdef HAVE_READLINK
|
|
Karsten Hopp |
458a31 |
+ static int resolve_symlink __ARGS((char_u *fname, char_u *buf));
|
|
Karsten Hopp |
458a31 |
+ #endif
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
/*
|
|
Karsten Hopp |
458a31 |
* Open a new memline for "buf".
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 1401,1410 ****
|
|
Karsten Hopp |
458a31 |
int i;
|
|
Karsten Hopp |
458a31 |
char_u *dirp;
|
|
Karsten Hopp |
458a31 |
char_u *dir_name;
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
if (list)
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
! /* use msg() to start the scrolling properly */
|
|
Karsten Hopp |
458a31 |
msg((char_u *)_("Swap files found:"));
|
|
Karsten Hopp |
458a31 |
msg_putchar('\n');
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
--- 1404,1422 ----
|
|
Karsten Hopp |
458a31 |
int i;
|
|
Karsten Hopp |
458a31 |
char_u *dirp;
|
|
Karsten Hopp |
458a31 |
char_u *dir_name;
|
|
Karsten Hopp |
458a31 |
+ char_u *fname_res = *fname;
|
|
Karsten Hopp |
458a31 |
+ #ifdef HAVE_READLINK
|
|
Karsten Hopp |
458a31 |
+ char_u fname_buf[MAXPATHL];
|
|
Karsten Hopp |
458a31 |
+
|
|
Karsten Hopp |
458a31 |
+ /* Expand symlink in the file name, because the swap file is created with
|
|
Karsten Hopp |
458a31 |
+ * the actual file instead of with the symlink. */
|
|
Karsten Hopp |
458a31 |
+ if (resolve_symlink(*fname, fname_buf) == OK)
|
|
Karsten Hopp |
458a31 |
+ fname_res = fname_buf;
|
|
Karsten Hopp |
458a31 |
+ #endif
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
if (list)
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
! /* use msg() to start the scrolling properly */
|
|
Karsten Hopp |
458a31 |
msg((char_u *)_("Swap files found:"));
|
|
Karsten Hopp |
458a31 |
msg_putchar('\n');
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 1453,1459 ****
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
else
|
|
Karsten Hopp |
458a31 |
! num_names = recov_file_names(names, *fname, TRUE);
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
else /* check directory dir_name */
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
--- 1465,1471 ----
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
else
|
|
Karsten Hopp |
458a31 |
! num_names = recov_file_names(names, fname_res, TRUE);
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
else /* check directory dir_name */
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 1490,1501 ****
|
|
Karsten Hopp |
458a31 |
if (after_pathsep(dir_name, p) && p[-1] == p[-2])
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
/* Ends with '//', Use Full path for swap name */
|
|
Karsten Hopp |
458a31 |
! tail = make_percent_swname(dir_name, *fname);
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
else
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
! tail = gettail(*fname);
|
|
Karsten Hopp |
458a31 |
tail = concat_fnames(dir_name, tail, TRUE);
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
if (tail == NULL)
|
|
Karsten Hopp |
458a31 |
--- 1502,1513 ----
|
|
Karsten Hopp |
458a31 |
if (after_pathsep(dir_name, p) && p[-1] == p[-2])
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
/* Ends with '//', Use Full path for swap name */
|
|
Karsten Hopp |
458a31 |
! tail = make_percent_swname(dir_name, fname_res);
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
else
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
! tail = gettail(fname_res);
|
|
Karsten Hopp |
458a31 |
tail = concat_fnames(dir_name, tail, TRUE);
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
if (tail == NULL)
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 1535,1545 ****
|
|
Karsten Hopp |
458a31 |
struct stat st;
|
|
Karsten Hopp |
458a31 |
char_u *swapname;
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
#if defined(VMS) || defined(RISCOS)
|
|
Karsten Hopp |
458a31 |
! swapname = modname(*fname, (char_u *)"_swp", FALSE);
|
|
Karsten Hopp |
458a31 |
#else
|
|
Karsten Hopp |
458a31 |
! swapname = modname(*fname, (char_u *)".swp", TRUE);
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
if (swapname != NULL)
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
if (mch_stat((char *)swapname, &st) != -1) /* It exists! */
|
|
Karsten Hopp |
458a31 |
--- 1547,1559 ----
|
|
Karsten Hopp |
458a31 |
struct stat st;
|
|
Karsten Hopp |
458a31 |
char_u *swapname;
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
+ swapname = modname(fname_res,
|
|
Karsten Hopp |
458a31 |
#if defined(VMS) || defined(RISCOS)
|
|
Karsten Hopp |
458a31 |
! (char_u *)"_swp", FALSE
|
|
Karsten Hopp |
458a31 |
#else
|
|
Karsten Hopp |
458a31 |
! (char_u *)".swp", TRUE
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
+ );
|
|
Karsten Hopp |
458a31 |
if (swapname != NULL)
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
if (mch_stat((char *)swapname, &st) != -1) /* It exists! */
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 3508,3515 ****
|
|
Karsten Hopp |
458a31 |
}
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
#ifdef HAVE_READLINK
|
|
Karsten Hopp |
458a31 |
- static int resolve_symlink __ARGS((char_u *fname, char_u *buf));
|
|
Karsten Hopp |
458a31 |
-
|
|
Karsten Hopp |
458a31 |
/*
|
|
Karsten Hopp |
458a31 |
* Resolve a symlink in the last component of a file name.
|
|
Karsten Hopp |
458a31 |
* Note that f_resolve() does it for every part of the path, we don't do that
|
|
Karsten Hopp |
458a31 |
--- 3522,3527 ----
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 3601,3609 ****
|
|
Karsten Hopp |
458a31 |
char_u *dir_name;
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
char_u *r, *s;
|
|
Karsten Hopp |
458a31 |
#ifdef HAVE_READLINK
|
|
Karsten Hopp |
458a31 |
char_u fname_buf[MAXPATHL];
|
|
Karsten Hopp |
458a31 |
- char_u *fname_res;
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
#if defined(UNIX) || defined(WIN3264) /* Need _very_ long file names */
|
|
Karsten Hopp |
458a31 |
--- 3613,3621 ----
|
|
Karsten Hopp |
458a31 |
char_u *dir_name;
|
|
Karsten Hopp |
458a31 |
{
|
|
Karsten Hopp |
458a31 |
char_u *r, *s;
|
|
Karsten Hopp |
458a31 |
+ char_u *fname_res = fname;
|
|
Karsten Hopp |
458a31 |
#ifdef HAVE_READLINK
|
|
Karsten Hopp |
458a31 |
char_u fname_buf[MAXPATHL];
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
#if defined(UNIX) || defined(WIN3264) /* Need _very_ long file names */
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 3625,3632 ****
|
|
Karsten Hopp |
458a31 |
* actual file instead of with the symlink. */
|
|
Karsten Hopp |
458a31 |
if (resolve_symlink(fname, fname_buf) == OK)
|
|
Karsten Hopp |
458a31 |
fname_res = fname_buf;
|
|
Karsten Hopp |
458a31 |
- else
|
|
Karsten Hopp |
458a31 |
- fname_res = fname;
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
r = buf_modname(
|
|
Karsten Hopp |
458a31 |
--- 3637,3642 ----
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 3639,3649 ****
|
|
Karsten Hopp |
458a31 |
/* Avoid problems if fname has special chars, eg <Wimp$Scrap> */
|
|
Karsten Hopp |
458a31 |
ffname,
|
|
Karsten Hopp |
458a31 |
#else
|
|
Karsten Hopp |
458a31 |
- # ifdef HAVE_READLINK
|
|
Karsten Hopp |
458a31 |
fname_res,
|
|
Karsten Hopp |
458a31 |
- # else
|
|
Karsten Hopp |
458a31 |
- fname,
|
|
Karsten Hopp |
458a31 |
- # endif
|
|
Karsten Hopp |
458a31 |
#endif
|
|
Karsten Hopp |
458a31 |
(char_u *)
|
|
Karsten Hopp |
458a31 |
#if defined(VMS) || defined(RISCOS)
|
|
Karsten Hopp |
458a31 |
--- 3649,3655 ----
|
|
Karsten Hopp |
458a31 |
*** ../vim-7.2.426/src/version.c 2010-05-14 17:32:53.000000000 +0200
|
|
Karsten Hopp |
458a31 |
--- src/version.c 2010-05-14 17:50:43.000000000 +0200
|
|
Karsten Hopp |
458a31 |
***************
|
|
Karsten Hopp |
458a31 |
*** 683,684 ****
|
|
Karsten Hopp |
458a31 |
--- 683,686 ----
|
|
Karsten Hopp |
458a31 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
458a31 |
+ /**/
|
|
Karsten Hopp |
458a31 |
+ 427,
|
|
Karsten Hopp |
458a31 |
/**/
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
--
|
|
Karsten Hopp |
458a31 |
Change is inevitable, except from a vending machine.
|
|
Karsten Hopp |
458a31 |
|
|
Karsten Hopp |
458a31 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
458a31 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
458a31 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
458a31 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|