New Issue: I/O module: bug with specifying a different start for the channel than 0

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
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
    CHPL_TARGET_PLATFORM: darwin
    CHPL_TARGET_COMPILER: clang
    CHPL_TARGET_ARCH: x86_64
    CHPL_TARGET_CPU: native
    CHPL_LOCALE_MODEL: flat
    CHPL_COMM: none
    CHPL_TASKS: qthreads
    CHPL_LAUNCHER: none
    CHPL_TIMERS: generic
    CHPL_UNWIND: none
    CHPL_MEM: jemalloc
    CHPL_ATOMICS: cstdlib
    CHPL_GMP: bundled
    CHPL_HWLOC: bundled
    CHPL_RE2: bundled
    CHPL_LLVM: none *
    CHPL_AUX_FILESYS: none
  • 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