dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.2k stars 1.57k forks source link

RandomAccessFile readSync() inconsistent with read() #8831

Closed DartBot closed 9 years ago

DartBot commented 11 years ago

This issue was originally filed by smok@google.com


Steps to reproduce ('somefile.txt' has 'hello' string): new File('somefile.txt').open().then((r) {   print(r.readSync(65535).length); }); Output: 65536

Not sure if it's a bug, but it looks weird and inconsistent with the following similar test result: new File('somefile.txt').open().then((r) {   r.read(65535).then((List<int> result) {     print(result.length);   }); }); Output: 5

If it helps, it all ends up in File_Read and FileReadRequest native implementation differences - the first one (used in readSync()) always returns the number of bytes requested, but the second one always returns list of the correct length.

sgjesse commented 11 years ago

Fixed in https://code.google.com/p/dart/source/detail?r=19145.


Added Fixed label.

kevmoo commented 10 years ago

Removed Area-IO label. Added Area-Library, Library-IO labels.