delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/04/21/14:47:13

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:message-id:date:to:subject
:in-reply-to:references:from; q=dns; s=default; b=g6lrJf1UKajPrI
gGIvssk9uTcU2QbpEaExXtO3W6gfOQCxxJwQTFRJR7wkhJBWanFoiJOpb0KN2xOE
Tgj7kpN9MwPu8wN+qvIrv/bKmYmjZOLyRmesNKsQezk45pjuvLOTqDWYFR566RAw
MjnUCmw1LvCNy+X3hh3gGoFK5pckk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:content-type
:content-transfer-encoding:message-id:date:to:subject
:in-reply-to:references:from; s=default; bh=/f16wc8TT0syUu3p1MZ7
WktZKhw=; b=hGVHSctV9htcdK4FEIFRHb7ckfAILraYTgMybKAkn3aBRAuK3hT8
lYZbifcNQARJ9QlYGe3J6GKC8LFV6AMWQHupR0sZcjGNQwSMi2Yh3DXelHL2QPtY
QKin4eZ4ks9h0M+0W4ZI31D5xNaSSsuC8GAKfEg9niL4CCQjTn95AyY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: mailbackend.panix.com
MIME-Version: 1.0
Message-ID: <21333.26515.393838.380071@compute01.cs.columbia.edu>
Date: Mon, 21 Apr 2014 14:46:43 -0400
To: cygwin AT cygwin DOT com
Subject: Re: fstat st_size on open files on Parallels filesystem is wrong
In-Reply-To: <227151856.20140421223417@yandex.ru>
References: <21333 DOT 25325 DOT 11106 DOT 958642 AT compute01 DOT cs DOT columbia DOT edu> <227151856 DOT 20140421223417 AT yandex DOT ru>
From: lennox AT cs DOT columbia DOT edu
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id s3LIl7BA031630

On Monday, April 21 2014, "Andrey Repin" wrote to "lennox at
cs.columbia.edu, cygwin at cygwin.com" saying:

> Greetings, lennox at cs.columbia.edu!
> 
> > 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.
> 
> You never flushing the buffer in your test code, or I'm reading it wrong?

This is using Posix APIs -- open() / write() -- not C APIs, fopen() /
fwrite(), so there shouldn't be a buffer?  Notice that the test behaves as I
expect for a file on NTFS.

Adding a call to fsync() prior to the fstat() call doesn't change anything.

I've modeled this as closely as I could on what it appears emacs is doing,
as far as I could tell.

-- 
Jonathan Lennox
lennox at cs.columbia.edu

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


- Raw text -


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