X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Tue, 20 Mar 2012 13:09:23 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: ftell() fails on files in shared folders Message-ID: <20120320120923.GB20228@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20120318155829 DOT GA21914 AT calimero DOT vinschen DOT de> <20120318191043 DOT GA32177 AT calimero DOT vinschen DOT de> <20120319091408 DOT GA30682 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Mar 20 13:48, Yuri Gribov wrote: > Corinna, > > > No, it doesn't change that often.  1.7.9 is actually a year old, > > though.  Updating *might* help. > > > > Btw., assuming you call lseek(fileno(p), SEEK_CUR, 0) rather than > > ftell(p), what position does it return? > > I have rewritten my program to use only low-level API (open, write, > lseek) and installed latest Cygwin. It seems that the error is caused > by O_RDWR - as soon as I change it to O_WRONLY everything starts to > work: > > Local, O_WRONLY: > C:\Users\gribov.y>\\s-cw-head\pgas\a.exe //s-cw-head/c$/test.bin > success > > Local, O_RDWR: > C:\Users\gribov.y>\\s-cw-head\pgas\a.exe //s-cw-head/c$/test.bin rw > success > > Remote, O_WRONLY: > C:\Users\gribov.y>\\s-cw-head\pgas\a.exe //s-cw-node01/c$/test.bin > success > > Remote, O_RDWR: > C:\Users\gribov.y>\\s-cw-head\pgas\a.exe //s-cw-node01/c$/test.bin rw > sizeof(data) == lseek(fd, 0, SEEK_END) failed at io.c:36 First of all, there's a bug in your testcase. lseek takesn off_t as second parameter, off_t on Cygwin is 64 bit. But your testcase doesn't #include , so the prototype for lseek is missing and lseek gets wrong data because the second parameter is put on the stack as type int (32 bit). Second, I still can't reproduce your issue. I added #include and then everything worked fine, regardless of using a local or remote file, and independent of adding "rw" or not. I tried with a Windows-based NTFS share and a Samba-based share. What filesystem is your remote FS? Please run bash$ /usr/lib/csih/getVolInfo //s-cw-node01/c\$ and paste the output here. You could also run the testcase under strace, like this: bash$ strace -o io.trace ./io //s-cw-node01/c\$/test.bin and send the strace here. Maybe we can figure out what's going on. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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