Bug 4123 - FileInfo returns invalid Length
Summary: FileInfo returns invalid Length
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: PC Linux
: Highest critical
Target Milestone: Untriaged
Assignee: Paolo Molaro
: 4107 ()
Depends on:
Reported: 2012-03-28 07:31 UTC by radekp
Modified: 2012-03-29 09:51 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

test program (4.62 KB, application/x-gzip)
2012-03-28 07:31 UTC, radekp

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description radekp 2012-03-28 07:31:28 UTC
Created attachment 1586 [details]
test program

FileInfo class in current git seems to report invalid file length via Length property.

I have checked ves_icall_System_IO_MonoIO_GetFileStat in file-io.c and the size is there ok. But in FileSystemInfo.cs after MonoIO.GetFileStat() call it's not.

Attached is simple test program.

Btw i am running mono compiled from git on ubuntu 12.04 beta1, monodevelop does not open files because of this bug here...
Comment 1 radekp 2012-03-28 07:32:39 UTC
Ohh and forgot that it's 32 bit os variant (running on core i7 intel processor)
Comment 2 Mikayla Hutchinson [MSFT] 2012-03-28 15:04:51 UTC
*** Bug 4107 has been marked as a duplicate of this bug. ***
Comment 3 Miguel de Icaza [MSFT] 2012-03-28 15:08:54 UTC

Could you look at this bug?   It is a high-priority problem for 2.11
Comment 4 Paolo Molaro 2012-03-29 09:51:43 UTC
Fixed in git.
When using certain compiler or compiler versions when compiling the mono runtime, we ended up not following the ABI correctly when interoperating with C code, in particular when 64 bit ints and doubles are used on some 32 bit platforms.
We now follow the ABI, so there is a small chance that some programs out there depended on the incorrect behaviour. Mono 2.11 (and hence 3.0) looks like the best opportunity to get this fix out, even if potentially it is a breaking change (but given that it affects something fundamental like FileInfo, the chances of effectively breaking someone's code should be pretty low).