delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/20/08:10:43

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 <corinna-cygwin AT cygwin DOT com>
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: <CAJOtW+5qwWvN84mJJ=NR3TgZE5s7jz8jpLTaN=+h1hv5Ob29XQ AT mail DOT gmail DOT com> <20120318155829 DOT GA21914 AT calimero DOT vinschen DOT de> <CAJOtW+4fMX_EEOBWhn0d6VPU7oq+k_Rx1CGYe4O16ccsNRV4ZA AT mail DOT gmail DOT com> <CAJOtW+4ZCvk3NarGn1qOFF-A+ZbFjithPJE8Ms-7FNFMH63A7Q AT mail DOT gmail DOT com> <20120318191043 DOT GA32177 AT calimero DOT vinschen DOT de> <CAJOtW+4UcSdbOqfch8Kzjh90FJP5ebtx-JJ7t8pGV2QZXiQ69A AT mail DOT gmail DOT com> <20120319091408 DOT GA30682 AT calimero DOT vinschen DOT de> <CAJOtW+5Mf9uYfe6x8+HsDxWyUmT11DFvDAs1QE00uj5uOayfaA AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAJOtW+5Mf9uYfe6x8+HsDxWyUmT11DFvDAs1QE00uj5uOayfaA@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

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 <unistd.h>, 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 <unistd.h>
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

- Raw text -


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