fstat st_size on open files on Parallels filesystem is wrong

lennox@cs.columbia.edu lennox@cs.columbia.edu
Mon Apr 21 18:27:00 GMT 2014


I’m running cygwin64 1.7.29 in a Windows 8.1 Pro virtual machine, running in
Parallels Desktop 9.0.24229 on Mac OS X 10.9.2.

Parallels Desktop automatically mounts my Mac OS X home directory as a Z:
drive in Windows.  Cygwin mount reports this drive as being type "prlsf".

Unfortunately, I've discovered that if I have an open file on this
filesystem which has been written to, the size returned by Cygwin fstat() on
the open file is wrong.  A stat() of the file after it's been closed is
correct.

This has the consequence that emacs always thinks saved files have been
modified externally, since emacs looks at files' sizes (as well as their
modification times) to detect external changes.  This makes emacs
near-unusable.

This problem does not occur for files in my Cygwin home directory, or other
locations mounted on my Windows C: drive.

I've attached a simple unit test program that illustrates the problem.
I've also attached my cygcheck -s -v -r output.

Any ideas?  Is this a Cygwin bug, a Parallels bug, or something else?
Glancing over the Cygwin code, I see that there are a few cases where fstat
has special cases for certain filesystem types.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stat-size-test.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140421/5c53908d/attachment.c>
-------------- next part --------------

$ ./stat-size-test.exe $HOME/foo /cygdrive/z/foo
/home/jonathan/foo: fstat: st_size=12
/home/jonathan/foo: stat: st_size=12
/cygdrive/z/foo: fstat: st_size=0
/cygdrive/z/foo: stat: st_size=12

$ mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
D: on /cygdrive/d type iso9660 (binary,posix=0,user,noumount,auto)
S: on /cygdrive/s type ntfs (binary,posix=0,user,noumount,auto)
U: on /cygdrive/u type ntfs (binary,posix=0,user,noumount,auto)
Z: on /cygdrive/z type prlsf (binary,posix=0,user,noumount,auto)

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140421/5c53908d/attachment.txt>
-------------- next part --------------

-- 
Jonathan Lennox
lennox@cs.columbia.edu

-------------- next part --------------
--
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