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.read
was not returningfalse
if a
binaryDeserializer
configured forlittle
orbig
endianness
failed to read an entire array. The solution is to check the returned
value of aread
call inreadBulkElements
and throw an EOF error
if it is false.- The version of
fileReader.readBinary
that accepts anumeric
byref
intent was not correctly throwing anUnexpectedEofError
despite the documentation clearly stating it should. The solution
involves a change to the runtime inqio_channel_read_amt
where 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