]>
Commit | Line | Data |
---|---|---|
9b1d76b7 AG |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.0.208 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.0.208 (after 7.0.171 and 7.0.180) | |
11 | Problem: VMS: changes to path handling cause more trouble than they solve. | |
12 | Solution: Revert changes. | |
13 | Files: src/buffer.c, src/memline.c, src/os_unix.c | |
14 | ||
15 | ||
16 | *** ../vim-7.0.207/src/buffer.c Tue Nov 28 17:44:51 2006 | |
17 | --- src/buffer.c Mon Mar 5 21:34:41 2007 | |
18 | *************** | |
19 | *** 4145,4157 **** | |
20 | /* | |
21 | * Force expanding the path always for Unix, because symbolic links may | |
22 | * mess up the full path name, even though it starts with a '/'. | |
23 | - * Also expand always for VMS, it may have alternate paths that need to be | |
24 | - * resolved. | |
25 | * Also expand when there is ".." in the file name, try to remove it, | |
26 | * because "c:/src/../README" is equal to "c:/README". | |
27 | * For MS-Windows also expand names like "longna~1" to "longname". | |
28 | */ | |
29 | ! #if defined(UNIX) || defined(VMS) | |
30 | return FullName_save(fname, TRUE); | |
31 | #else | |
32 | if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL | |
33 | --- 4145,4155 ---- | |
34 | /* | |
35 | * Force expanding the path always for Unix, because symbolic links may | |
36 | * mess up the full path name, even though it starts with a '/'. | |
37 | * Also expand when there is ".." in the file name, try to remove it, | |
38 | * because "c:/src/../README" is equal to "c:/README". | |
39 | * For MS-Windows also expand names like "longna~1" to "longname". | |
40 | */ | |
41 | ! #ifdef UNIX | |
42 | return FullName_save(fname, TRUE); | |
43 | #else | |
44 | if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL | |
45 | *** ../vim-7.0.207/src/memline.c Tue Feb 13 04:03:05 2007 | |
46 | --- src/memline.c Mon Mar 5 21:34:41 2007 | |
47 | *************** | |
48 | *** 3592,3600 **** | |
49 | #else | |
50 | (buf->b_p_sn || buf->b_shortname), | |
51 | #endif | |
52 | ! #if defined(VMS) || defined(RISCOS) | |
53 | ! /* Avoid problems if fname has special chars, eg <Wimp$Scrap>. | |
54 | ! * For VMS always use full path for swapfile. */ | |
55 | ffname, | |
56 | #else | |
57 | # ifdef HAVE_READLINK | |
58 | --- 3592,3599 ---- | |
59 | #else | |
60 | (buf->b_p_sn || buf->b_shortname), | |
61 | #endif | |
62 | ! #ifdef RISCOS | |
63 | ! /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */ | |
64 | ffname, | |
65 | #else | |
66 | # ifdef HAVE_READLINK | |
67 | *** ../vim-7.0.207/src/os_unix.c Tue Feb 27 16:51:07 2007 | |
68 | --- src/os_unix.c Mon Mar 5 21:40:31 2007 | |
69 | *************** | |
70 | *** 2214,2262 **** | |
71 | int len; | |
72 | int force; /* also expand when already absolute path */ | |
73 | { | |
74 | - #ifdef VMS | |
75 | - /* | |
76 | - * VMS does this in a completely different way. | |
77 | - * | |
78 | - * By default a file found in a complex path is written to the first | |
79 | - * directory in the path and not to the original directory. This | |
80 | - * behaviour should be avoided for the existing files and we need to find | |
81 | - * the exact path of the edited file. | |
82 | - */ | |
83 | - { | |
84 | - char_u *fixed_fname = vms_fixfilename(fname); | |
85 | - int fd = mch_open((char *)fixed_fname, O_RDONLY | O_EXTRA, 0); | |
86 | - | |
87 | - if (fd > 0) | |
88 | - { | |
89 | - char nbuf[MAXNAMLEN]; | |
90 | - | |
91 | - /* File exists, use getname() to get the real name. */ | |
92 | - if (getname(fd, nbuf)) | |
93 | - vim_strncpy(fixed_fname, (char_u *)nbuf, (size_t)(len - 1)); | |
94 | - close(fd); | |
95 | - } | |
96 | - | |
97 | - if (STRLEN(fixed_fname) >= len) | |
98 | - return FAIL; | |
99 | - | |
100 | - STRCPY(buf, fixed_fname); | |
101 | - } | |
102 | - | |
103 | - #else /* not VMS */ | |
104 | - | |
105 | int l; | |
106 | ! # ifdef OS2 | |
107 | int only_drive; /* file name is only a drive letter */ | |
108 | ! # endif | |
109 | ! # ifdef HAVE_FCHDIR | |
110 | int fd = -1; | |
111 | static int dont_fchdir = FALSE; /* TRUE when fchdir() doesn't work */ | |
112 | ! # endif | |
113 | char_u olddir[MAXPATHL]; | |
114 | char_u *p; | |
115 | int retval = OK; | |
116 | ||
117 | /* expand it if forced or not an absolute path */ | |
118 | if (force || !mch_isFullName(fname)) | |
119 | { | |
120 | --- 2214,2235 ---- | |
121 | int len; | |
122 | int force; /* also expand when already absolute path */ | |
123 | { | |
124 | int l; | |
125 | ! #ifdef OS2 | |
126 | int only_drive; /* file name is only a drive letter */ | |
127 | ! #endif | |
128 | ! #ifdef HAVE_FCHDIR | |
129 | int fd = -1; | |
130 | static int dont_fchdir = FALSE; /* TRUE when fchdir() doesn't work */ | |
131 | ! #endif | |
132 | char_u olddir[MAXPATHL]; | |
133 | char_u *p; | |
134 | int retval = OK; | |
135 | ||
136 | + #ifdef VMS | |
137 | + fname = vms_fixfilename(fname); | |
138 | + #endif | |
139 | + | |
140 | /* expand it if forced or not an absolute path */ | |
141 | if (force || !mch_isFullName(fname)) | |
142 | { | |
143 | *************** | |
144 | *** 2265,2280 **** | |
145 | * and then do the getwd() (and get back to where we were). | |
146 | * This will get the correct path name with "../" things. | |
147 | */ | |
148 | ! # ifdef OS2 | |
149 | only_drive = 0; | |
150 | if (((p = vim_strrchr(fname, '/')) != NULL) | |
151 | || ((p = vim_strrchr(fname, '\\')) != NULL) | |
152 | || (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive)) | |
153 | ! # else | |
154 | if ((p = vim_strrchr(fname, '/')) != NULL) | |
155 | ! # endif | |
156 | { | |
157 | ! # ifdef HAVE_FCHDIR | |
158 | /* | |
159 | * Use fchdir() if possible, it's said to be faster and more | |
160 | * reliable. But on SunOS 4 it might not work. Check this by | |
161 | --- 2238,2253 ---- | |
162 | * and then do the getwd() (and get back to where we were). | |
163 | * This will get the correct path name with "../" things. | |
164 | */ | |
165 | ! #ifdef OS2 | |
166 | only_drive = 0; | |
167 | if (((p = vim_strrchr(fname, '/')) != NULL) | |
168 | || ((p = vim_strrchr(fname, '\\')) != NULL) | |
169 | || (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive)) | |
170 | ! #else | |
171 | if ((p = vim_strrchr(fname, '/')) != NULL) | |
172 | ! #endif | |
173 | { | |
174 | ! #ifdef HAVE_FCHDIR | |
175 | /* | |
176 | * Use fchdir() if possible, it's said to be faster and more | |
177 | * reliable. But on SunOS 4 it might not work. Check this by | |
178 | *************** | |
179 | *** 2290,2303 **** | |
180 | dont_fchdir = TRUE; /* don't try again */ | |
181 | } | |
182 | } | |
183 | ! # endif | |
184 | ||
185 | /* Only change directory when we are sure we can return to where | |
186 | * we are now. After doing "su" chdir(".") might not work. */ | |
187 | if ( | |
188 | ! # ifdef HAVE_FCHDIR | |
189 | fd < 0 && | |
190 | ! # endif | |
191 | (mch_dirname(olddir, MAXPATHL) == FAIL | |
192 | || mch_chdir((char *)olddir) != 0)) | |
193 | { | |
194 | --- 2263,2276 ---- | |
195 | dont_fchdir = TRUE; /* don't try again */ | |
196 | } | |
197 | } | |
198 | ! #endif | |
199 | ||
200 | /* Only change directory when we are sure we can return to where | |
201 | * we are now. After doing "su" chdir(".") might not work. */ | |
202 | if ( | |
203 | ! #ifdef HAVE_FCHDIR | |
204 | fd < 0 && | |
205 | ! #endif | |
206 | (mch_dirname(olddir, MAXPATHL) == FAIL | |
207 | || mch_chdir((char *)olddir) != 0)) | |
208 | { | |
209 | *************** | |
210 | *** 2306,2312 **** | |
211 | } | |
212 | else | |
213 | { | |
214 | ! # ifdef OS2 | |
215 | /* | |
216 | * compensate for case where ':' from "D:" was the only | |
217 | * path separator detected in the file name; the _next_ | |
218 | --- 2279,2285 ---- | |
219 | } | |
220 | else | |
221 | { | |
222 | ! #ifdef OS2 | |
223 | /* | |
224 | * compensate for case where ':' from "D:" was the only | |
225 | * path separator detected in the file name; the _next_ | |
226 | *************** | |
227 | *** 2314,2320 **** | |
228 | */ | |
229 | if (only_drive) | |
230 | p++; | |
231 | ! # endif | |
232 | /* The directory is copied into buf[], to be able to remove | |
233 | * the file name without changing it (could be a string in | |
234 | * read-only memory) */ | |
235 | --- 2287,2293 ---- | |
236 | */ | |
237 | if (only_drive) | |
238 | p++; | |
239 | ! #endif | |
240 | /* The directory is copied into buf[], to be able to remove | |
241 | * the file name without changing it (could be a string in | |
242 | * read-only memory) */ | |
243 | *************** | |
244 | *** 2329,2342 **** | |
245 | fname = p + 1; | |
246 | *buf = NUL; | |
247 | } | |
248 | ! # ifdef OS2 | |
249 | if (only_drive) | |
250 | { | |
251 | p--; | |
252 | if (retval != FAIL) | |
253 | fname--; | |
254 | } | |
255 | ! # endif | |
256 | } | |
257 | } | |
258 | if (mch_dirname(buf, len) == FAIL) | |
259 | --- 2302,2315 ---- | |
260 | fname = p + 1; | |
261 | *buf = NUL; | |
262 | } | |
263 | ! #ifdef OS2 | |
264 | if (only_drive) | |
265 | { | |
266 | p--; | |
267 | if (retval != FAIL) | |
268 | fname--; | |
269 | } | |
270 | ! #endif | |
271 | } | |
272 | } | |
273 | if (mch_dirname(buf, len) == FAIL) | |
274 | *************** | |
275 | *** 2346,2359 **** | |
276 | } | |
277 | if (p != NULL) | |
278 | { | |
279 | ! # ifdef HAVE_FCHDIR | |
280 | if (fd >= 0) | |
281 | { | |
282 | l = fchdir(fd); | |
283 | close(fd); | |
284 | } | |
285 | else | |
286 | ! # endif | |
287 | l = mch_chdir((char *)olddir); | |
288 | if (l != 0) | |
289 | EMSG(_(e_prev_dir)); | |
290 | --- 2319,2332 ---- | |
291 | } | |
292 | if (p != NULL) | |
293 | { | |
294 | ! #ifdef HAVE_FCHDIR | |
295 | if (fd >= 0) | |
296 | { | |
297 | l = fchdir(fd); | |
298 | close(fd); | |
299 | } | |
300 | else | |
301 | ! #endif | |
302 | l = mch_chdir((char *)olddir); | |
303 | if (l != 0) | |
304 | EMSG(_(e_prev_dir)); | |
305 | *************** | |
306 | *** 2362,2373 **** | |
307 | --- 2335,2348 ---- | |
308 | l = STRLEN(buf); | |
309 | if (l >= len) | |
310 | retval = FAIL; | |
311 | + #ifndef VMS | |
312 | else | |
313 | { | |
314 | if (l > 0 && buf[l - 1] != '/' && *fname != NUL | |
315 | && STRCMP(fname, ".") != 0) | |
316 | STRCAT(buf, "/"); | |
317 | } | |
318 | + #endif | |
319 | } | |
320 | ||
321 | /* Catch file names which are too long. */ | |
322 | *************** | |
323 | *** 2377,2384 **** | |
324 | /* Do not append ".", "/dir/." is equal to "/dir". */ | |
325 | if (STRCMP(fname, ".") != 0) | |
326 | STRCAT(buf, fname); | |
327 | - | |
328 | - #endif /* VMS */ | |
329 | ||
330 | return OK; | |
331 | } | |
332 | --- 2352,2357 ---- | |
333 | *** ../vim-7.0.207/src/version.c Sun Mar 4 21:25:44 2007 | |
334 | --- src/version.c Tue Mar 6 20:22:52 2007 | |
335 | *************** | |
336 | *** 668,669 **** | |
337 | --- 668,671 ---- | |
338 | { /* Add new patch number below this line */ | |
339 | + /**/ | |
340 | + 208, | |
341 | /**/ | |
342 | ||
343 | -- | |
344 | hundred-and-one symptoms of being an internet addict: | |
345 | 262. Your computer has it's own phone line - but your daughter doesn't. | |
346 | ||
347 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
348 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
349 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
350 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |