Branch: refs/heads/main
Revision: 9899abfdfd299d8f48ccff714f9ca8e13dd3f4dc
Author: benharsh
Link: Fix some bugs related to an unexpected end of file by benharsh · Pull Request #23958 · chapel-lang/chapel · GitHub
Log Message:
Fix some bugs related to an unexpected end of file (#23958)
This PR addresses two bugs related to potentially unexpected end of file
IO calls:
fileReader.readwas not returningfalseif a
binaryDeserializerconfigured forlittleorbigendianness
failed to read an entire array. The solution is to check the returned
value of areadcall inreadBulkElementsand throw an EOF error
if it is false.- The version of
fileReader.readBinarythat accepts anumeric
byrefintent was not correctly throwing anUnexpectedEofError
despite the documentation clearly stating it should. The solution
involves a change to the runtime inqio_channel_read_amtwhere we
check if we got an EOF and failed to read the expected amount of bytes.
This PR also retires a .future and updates the test to be more robust. A
new test specifically for the readBinary-numeric case is also added.
[reviewed-by @lydia-duncan]
Diff:
M modules/standard/IO.chpl
M runtime/include/qio/qio.h
D test/io/bharshbarg/seek-short.bad
M test/io/bharshbarg/seek-short.chpl
D test/io/bharshbarg/seek-short.future
M test/io/bharshbarg/seek-short.good
A test/io/jhh/readbinary-eof.eshort.good
M test/io/jhh/readbinary-eof.execopts
A test/library/standard/IO/readBinary/shortRead.chpl
A test/library/standard/IO/readBinary/shortRead.good
https://github.com/chapel-lang/chapel/pull/23958.diff