apparent bug: incorrect file position after write()

imaginate australiamail.com imaginate@australiamail.com
Sat Mar 5 09:30:00 GMT 2005


I'm experiencing unexpected behaviour under cygwin that as far as I 
know doesn't happen under linux.  I don't have access to linux to 
test at present.

Some successful write()s to a file increment the file's position by 
more than the count argument.  The extra byte(s) are added to the 
file's size and can be read by lseek()ing to the exact location 
where the extra byte(s) start.  When reading from a location prior 
to this location the extra byte(s) become invisible although they 
can affect the values returned from read() and lseek().

I have other priorities that prevent me from debugging the cygwin 
source code however I have produced some code that reliably 
replicates the problem.  I have attached two source files, one of 
which is the bare minimum to reproduce the problem and the other of 
which does a bit more analysis.  They can each be compiled simply 
by giving the filename as an argument to gcc.

Also attached is a file with the contents of a shell session where 
I demonstrate the results I am getting from the programs on this 
machine.  Finally I have attached the results of the cygcheck -s -v 
-r command.  The 'xyz' directory is not its actual name but this as 
far as I can see is irrelevant to the problem.

Have at it folks...

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 8602 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050305/b9647909/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: shell.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050305/b9647909/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shortnsweet.c
Type: application/octet-stream
Size: 1980 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050305/b9647909/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: writetest.c
Type: application/octet-stream
Size: 10962 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050305/b9647909/attachment-0002.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list