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