damaki/ksum

Text mode is ignored on Windows.

damaki opened this issue · 0 comments

When ksum is run on Windows the expected behaviour of --text mode is that CRLF newlines are converted to LF newlines when reading input data. However, file data is always read in binary mode and CRLF are not converted, i.e. --text mode has the same behaviour as --binary on all systems.

After some investigation, this seems to be caused by using Ada.Text_IO.Text_Streams to read from the input files. Even when the file is opened with Form="text_translation=yes", stream reading always sets the file to binary mode before performing the read. See Ada RM A.12.2/6 which mentions mixing text/binary modes for text streams.