[Mono-bugs] [Bug 76192][Nor] New - Can't write files past 2gb on AMD64 (x86_64)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Sep 22 17:02:13 EDT 2005

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by brion at pobox.com.


--- shadow/76192	2005-09-22 17:02:13.000000000 -0400
+++ shadow/76192.tmp.8672	2005-09-22 17:02:13.000000000 -0400
@@ -0,0 +1,45 @@
+Bug#: 76192
+Product: Mono: Runtime
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Fedora Core 3 x86_64
+Status: NEW   
+Priority: Normal
+Component: io-layer
+AssignedTo: dick at ximian.com                            
+ReportedBy: brion at pobox.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Can't write files past 2gb on AMD64 (x86_64)
+Description of Problem:
+Attempting to write to a file with FileStream.Write() fails when the file size reaches 2 gigabytes on 
+an x86_64 system. An strace shows that at the failure point is an lseek() to an impossibly large 
+offset, which fails and triggers an IO exception.
+Steps to reproduce the problem:
+1. Create new file with File.Create()
+2. Write to it with .Write() until you reach 2gb
+Actual Results:
+lseek(5, 2139095040, SEEK_SET)          = 2139095040
+lseek(5, 0, SEEK_CUR)                   = 2139095040
+lseek(5, 18446744071564165120, SEEK_SET) = -1 EINVAL (Invalid argument)
+Expected Results:
+Should keep seeking to sane values and write successfully.
+How often does this happen? 
+Every time.
+Additional Information:
+Problem appears to be sign extension in mono/io-layer/io.c's file_seek() function. Test case and 
+patch will be attached.

More information about the mono-bugs mailing list