Divergent file system contents, Cygwin versus Windows 7

Andrew Hancock andymhancock@gmail.com
Sun Jun 26 15:14:00 GMT 2011


I am seeing two different versions of a file depending on how I access
it.  Specifically, the file "C:\Program Files (x86)\Vim\_vimrc" uses
plain text to provide startup specifications for the text editor gvim.
 This is the standalone installation for Windows, not the one the one
that comes with Cygwin.  However, that is just the problem context.
The real issue is that I see two different versions of that file
depending on whether I access it from Windows for Cygwin.  The first
version is from before a modification I made, and the second version
is from the modification itself (adding the following two lines, the
exact meanings of which aren't central to the problem):

  set guioptions-=m
  set guioptions-=T

When I saved the modified file, I got a warning that the file is
read-only.  It isn't read-only (for the owner) according to "ls -l"
and according to the file's Properties panel pulled up in Windows.  I
thought that the discrepancy must have been due to Windows 7's more
complicated security (which I haven't completely figured out).  I
forced the save with "w!", tested it by restarting gvim, and found
that the settings did not take.  I wondered whether the file actually
contained the above two lines that I added.

It turns out that it depends on how the file is accessed.  If I access
the file using notepad or windows-based gvim, the two added lines are
not present (same thing if I use Windows's "more" from cmd.exe).  On
the other hand, if I access the file using vim or less from cygwin's
bash shell, the two added lines *are* present.  I initially didn't
recall whether the modification was made from a Windows editor or a
Cygwin editor.  However, further testing indicates that it must have
been via Cygwin, since the Windows-based gvim merely retorts "Can't
open file for writing".

After googling about different versions of files on Windows 7, I found
that one possible cause might be the backups that the OS makes.
However, I confirmed that this particular file has no backups.  This
doesn't appear to be the problem.

Right now, I am not sure whether this is a Windows 7 problem or a
cygwin problem (or more likely, an interaction between them).  I don't
want to force both copies to be the same by simply editting the file
using the Windows-base gvim.  This hides a problem that will
doubtlessly come back and cause great grief.  In fact, after
replicating the problem with a copy of _vimrc (Test.txt), I found that
the problem is much broader than just edits to a file.  I could delete
Test.txt in Windows Explorer and still be able to see and edit it from
Cygwin Bash.  In other cases, after a failed attempt to write a
modified file from Windows's gvim, the file appears empty from
Cygwin's "less" (and can't be overwritten by a bash pipe) even though
the content is clearly visible from Windows's Notepad and gvim.

Thanks for any comments or suggestions for courses of action.  I'm
beginning to wonder if a fundamental incompatibility with Windows 7
(64-bit, in case it matters) could prevent the use of Cygwin on my
machine.   Mega- :(

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list