On Oct 13 18:10, James Vega wrote: > On Fri, Oct 13, 2006 at 10:34:40PM +0200, Corinna Vinschen wrote: > > On Oct 13 16:06, James Vega wrote: > > > On Fri, Oct 13, 2006 at 09:38:16PM +0200, Corinna Vinschen wrote: > > > > Interesting enough it works in 6.4 without doing anything similar to my > > > > patch does to os_unix.c. What's different in swap file handling between > > > > 6.4 and 7.0 so that it works in the former but doesn;t in the latter? > > > > > > memline.c was changed for 7.0 as far as how Vim determined where to > > > store the swapfile when editing symlinks. The change was to follow the > > > symlink, find the directory the actual file was in and key off that when > > > creating the swapfile so that editing the symlink and the actual file at > > > the same time would cause the 'swapfile already exists' message. Maybe > > > this is related. The relevant code is sectioned off by '#ifdef > > > HAVE_READLINK'/'#endif' sections in memline.c > > > > Thanks for this hint. I'll look into that in the next couple of days. > > It doesn't seem to be related to the actual directory in which to place > > the swap file, though. "directory" is set to /tmp in my example, so the > > swap file should be created there. > > I misspoke slightly in my previous email. The patch isn't purely about > where to store the file. It primarily deals with determining what > actual file is being edited so that proper swapfile checking can be > performed. In order to do this it has to resolve the symlink and > determines the absolute path for the file being edited. It may be that > determining the absolute path is causing the mixup in path formats, > although that seems unlikely since it is a common function used > throughout Vim.
It's about getting the correct basename, as my example shows. The path separator is slash-only in the unix case, an absolute path is one starting with / or ~, except OS2 is defined. As a result, the path C:\foo\bar is recognized as relative path. The next result is that the basename is the full path since it doesn't contain slashes. So the full path is concatenated to the swap directory, thus resulting in /tmp/C:\foo\bar. As far as I can see the culprit is the combination mch_FullName/mch_isFullName. Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat