]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.427
- new
[packages/vim.git] / 7.2.427
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.427
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.2.427
11 Problem:    The swapfile is created using the destination of a symlink, but
12             recovery doesn't follow symlinks.
13 Solution:   When recovering, resolve symlinks. (James Vega)
14 Files:      src/memline.c
15
16
17 *** ../vim-7.2.426/src/memline.c        2010-03-10 14:46:21.000000000 +0100
18 --- src/memline.c       2010-05-14 17:28:29.000000000 +0200
19 ***************
20 *** 245,250 ****
21 --- 245,253 ----
22   #ifdef FEAT_BYTEOFF
23   static void ml_updatechunk __ARGS((buf_T *buf, long line, long len, int updtype));
24   #endif
25 + #ifdef HAVE_READLINK
26 + static int resolve_symlink __ARGS((char_u *fname, char_u *buf));
27 + #endif
28   
29   /*
30    * Open a new memline for "buf".
31 ***************
32 *** 1401,1410 ****
33       int               i;
34       char_u    *dirp;
35       char_u    *dir_name;
36   
37       if (list)
38       {
39 !           /* use msg() to start the scrolling properly */
40         msg((char_u *)_("Swap files found:"));
41         msg_putchar('\n');
42       }
43 --- 1404,1422 ----
44       int               i;
45       char_u    *dirp;
46       char_u    *dir_name;
47 +     char_u    *fname_res = *fname;
48 + #ifdef HAVE_READLINK
49 +     char_u    fname_buf[MAXPATHL];
50
51 +     /* Expand symlink in the file name, because the swap file is created with
52 +      * the actual file instead of with the symlink. */
53 +     if (resolve_symlink(*fname, fname_buf) == OK)
54 +       fname_res = fname_buf;
55 + #endif
56   
57       if (list)
58       {
59 !       /* use msg() to start the scrolling properly */
60         msg((char_u *)_("Swap files found:"));
61         msg_putchar('\n');
62       }
63 ***************
64 *** 1453,1459 ****
65   #endif
66             }
67             else
68 !               num_names = recov_file_names(names, *fname, TRUE);
69         }
70         else                        /* check directory dir_name */
71         {
72 --- 1465,1471 ----
73   #endif
74             }
75             else
76 !               num_names = recov_file_names(names, fname_res, TRUE);
77         }
78         else                        /* check directory dir_name */
79         {
80 ***************
81 *** 1490,1501 ****
82                 if (after_pathsep(dir_name, p) && p[-1] == p[-2])
83                 {
84                     /* Ends with '//', Use Full path for swap name */
85 !                   tail = make_percent_swname(dir_name, *fname);
86                 }
87                 else
88   #endif
89                 {
90 !                   tail = gettail(*fname);
91                     tail = concat_fnames(dir_name, tail, TRUE);
92                 }
93                 if (tail == NULL)
94 --- 1502,1513 ----
95                 if (after_pathsep(dir_name, p) && p[-1] == p[-2])
96                 {
97                     /* Ends with '//', Use Full path for swap name */
98 !                   tail = make_percent_swname(dir_name, fname_res);
99                 }
100                 else
101   #endif
102                 {
103 !                   tail = gettail(fname_res);
104                     tail = concat_fnames(dir_name, tail, TRUE);
105                 }
106                 if (tail == NULL)
107 ***************
108 *** 1535,1545 ****
109             struct stat     st;
110             char_u          *swapname;
111   
112   #if defined(VMS) || defined(RISCOS)
113 !           swapname = modname(*fname, (char_u *)"_swp", FALSE);
114   #else
115 !           swapname = modname(*fname, (char_u *)".swp", TRUE);
116   #endif
117             if (swapname != NULL)
118             {
119                 if (mch_stat((char *)swapname, &st) != -1)          /* It exists! */
120 --- 1547,1559 ----
121             struct stat     st;
122             char_u          *swapname;
123   
124 +           swapname = modname(fname_res,
125   #if defined(VMS) || defined(RISCOS)
126 !                              (char_u *)"_swp", FALSE
127   #else
128 !                              (char_u *)".swp", TRUE
129   #endif
130 +                             );
131             if (swapname != NULL)
132             {
133                 if (mch_stat((char *)swapname, &st) != -1)          /* It exists! */
134 ***************
135 *** 3508,3515 ****
136   }
137   
138   #ifdef HAVE_READLINK
139 - static int resolve_symlink __ARGS((char_u *fname, char_u *buf));
140
141   /*
142    * Resolve a symlink in the last component of a file name.
143    * Note that f_resolve() does it for every part of the path, we don't do that
144 --- 3522,3527 ----
145 ***************
146 *** 3601,3609 ****
147       char_u    *dir_name;
148   {
149       char_u    *r, *s;
150   #ifdef HAVE_READLINK
151       char_u    fname_buf[MAXPATHL];
152 -     char_u    *fname_res;
153   #endif
154   
155   #if defined(UNIX) || defined(WIN3264)  /* Need _very_ long file names */
156 --- 3613,3621 ----
157       char_u    *dir_name;
158   {
159       char_u    *r, *s;
160 +     char_u    *fname_res = fname;
161   #ifdef HAVE_READLINK
162       char_u    fname_buf[MAXPATHL];
163   #endif
164   
165   #if defined(UNIX) || defined(WIN3264)  /* Need _very_ long file names */
166 ***************
167 *** 3625,3632 ****
168        * actual file instead of with the symlink. */
169       if (resolve_symlink(fname, fname_buf) == OK)
170         fname_res = fname_buf;
171 -     else
172 -       fname_res = fname;
173   #endif
174   
175       r = buf_modname(
176 --- 3637,3642 ----
177 ***************
178 *** 3639,3649 ****
179             /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */
180             ffname,
181   #else
182 - # ifdef HAVE_READLINK
183             fname_res,
184 - # else
185 -           fname,
186 - # endif
187   #endif
188             (char_u *)
189   #if defined(VMS) || defined(RISCOS)
190 --- 3649,3655 ----
191 *** ../vim-7.2.426/src/version.c        2010-05-14 17:32:53.000000000 +0200
192 --- src/version.c       2010-05-14 17:50:43.000000000 +0200
193 ***************
194 *** 683,684 ****
195 --- 683,686 ----
196   {   /* Add new patch number below this line */
197 + /**/
198 +     427,
199   /**/
200
201 -- 
202 Change is inevitable, except from a vending machine.
203
204  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
205 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
206 \\\        download, build and distribute -- http://www.A-A-P.org        ///
207  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.036856 seconds and 3 git commands to generate.