delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/22/13:53:27

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 22 Apr 2002 13:52:04 -0400 (EDT)
From: Chris Metcalf <metcalf AT incert DOT com>
To: Bram AT vim DOT org
cc: cygwin AT cygwin DOT com, <vim-dev AT vim DOT org>
Subject: small inter-operability patch for vim 6.1.2 for Cygwin
Message-ID: <Pine.LNX.4.44.0204221337140.19476-100000@rd.incert.com>
MIME-Version: 1.0

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.)

Thanks,
                Chris Metcalf -- InCert Software -- 1 (617) 621 8080
                metcalf AT incert DOT com -- http://www.incert.com/~metcalf

--- 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 == ':');
 #else
 # 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
 #  ifdef BACKSLASH_IN_FILENAME
     return (c == ':' || c == '/' || c == '\\');


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019