small inter-operability patch for vim 6.1.2 for Cygwin

Chris Metcalf
Mon Apr 22 11:30:00 GMT 2002

This small change fixes an interoperability problem with vim in Cygwin. If
the Cygwin vim is invoked by non-Cygwin aware tools, it may be passed a
backslash-separated path.  Since vim is essentially Unix-built for Cygwin,
it doesn't realize it should recognize the backslashes as path separators,
and fails to create a valid .swp file path (error "E303").

For example, the Cygwin cvs.exe is substantially slower at updates than a
non-Cygwin build, presumably because of stat() overheads.  Both versions
of cvs.exe will use $EDITOR to get checkin comments from the user, but the
non-Cygwin version will pass a C:\TEMP\... path to vim.  (While it is
possible to set up a $CVSEDITOR .bat file that runs "cygpath -u" on its
argument, this seems more like a bandaid than a proper fix.)

The attached patch just modifies the vim_ispathsep() function to be 
Cygwin-aware.  IMHO, the full BACKSLASH_IN_FILENAME mechanism is 
inappropriate for Cygwin vim, since it really wants to present a complete 
Unix facade to the user.  However, when backslashes are supplied in 
filenames, the underlying OS *will* treat them as directory separators, so 
vim must be aware of special characters as separators.

(I am not subscribed to vim-dev but have cc'ed it based on the comments in 
vim's README.txt.)

                Chris Metcalf -- InCert Software -- 1 (617) 621 8080

--- vim-6.1-2/src/misc1.c	Sun Mar 17 08:12:29 2002
+++ vim-6.1-2-build/src/misc1.c	Mon Apr 22 13:35:36 2002
@@ -3709,7 +3709,11 @@
     return (c == '.' || c == ':');
 # ifdef UNIX
+#   ifdef __CYGWIN__  /* The OS will truly separate on ':' and '\\' */
+    return (c == ':' || c == '/' || c == '\\');
+#   else
     return (c == '/');	    /* UNIX has ':' inside file names */
+#   endif
 # else
     return (c == ':' || c == '/' || c == '\\');

Unsubscribe info:
Bug reporting:

More information about the Cygwin mailing list