[Chapel Merge] Fix some bugs related to an unexpected end of file

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:

  1. fileReader.read was not returning false if a
    binaryDeserializer configured for little or big endianness
    failed to read an entire array. The solution is to check the returned
    value of a read call in readBulkElements and throw an EOF error
    if it is false.
  2. The version of fileReader.readBinary that accepts a numeric
    by ref intent was not correctly throwing an UnexpectedEofError
    despite the documentation clearly stating it should. The solution
    involves a change to the runtime in qio_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]

Compare: Comparing d2f310ac8bbfe4065f26eb45261c3102773ee4eb...1af022abb66eb47136f0d30f6bcb081ac3c674eb · chapel-lang/chapel · GitHub

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