20449, "lydia-duncan", "I/O module: bug with specifying a different start for the channel than 0", "2022-08-16T15:09:21Z"
Summary of Problem
I discovered that if a file already has contents and you create a writing channel (at least using openwriter, though I don't see why file.writer would behave any differently since openwriter calls it), specifying a starting location other than 0 will cause all the characters prior to your starting location to be re-interpreted as binary.
This seems incorrect - I would expect the contents of the file outside of the specified region to be untouched, enabling concurrent modifications to distinct parts of the file.
Steps to Reproduce
Source Code:
use IO;
var filename = "openwriterLimited.txt";
var writeCh = openwriter(filename);
writeCh.writeln("She said she was looking for me");
writeCh.close();
var writeChStart = openwriter(filename, start=31);
writeChStart.write("us");
writeChStart.close();
Compile command: chpl foo.chpl
Execution command: ./foo
Associated Future Test(s):
TBA
Configuration Information
Output of chpl --version: chpl version 1.28.0 pre-release
Back-end compiler and version, e.g. gcc --version or clang --version:
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin