Skip to content

Fairlight CMI: do not write voice files into a hard-coded folder - #343

Open
douglas-carmichael wants to merge 1 commit into
git-moss:mainfrom
douglas-carmichael:fix-cmi3-debug-file-write
Open

Fairlight CMI: do not write voice files into a hard-coded folder#343
douglas-carmichael wants to merge 1 commit into
git-moss:mainfrom
douglas-carmichael:fix-cmi3-debug-file-write

Conversation

@douglas-carmichael

Copy link
Copy Markdown
Contributor

Reading a Voice file whose version is not recognized writes a copy of that file to C:\Users\mos\Desktop\Output before the error is reported — leftover debug output in FairlightCmi3Detector.readVoice:

Files.write (new File ("C:\\Users\\mos\\Desktop\\Output\\" + fileName + ".VC").toPath (), inBytes);

throw new IOException (Functions.getMessage ("IDS_CMI3_UNKNOWN_VERSION", Integer.toString (version)));

Analysing a source is expected to write nothing, and on three platforms it does something different:

  • macOS and Linux: a backslash is an ordinary file name character, so the whole path becomes the name of a single file created in the current working directory. Analysing the CMI IIx library images leaves 76 files called C:\Users\mos\Desktop\Output\….VC next to whatever the user was working in.
  • Windows, folder present: it silently fills that folder.
  • Windows, folder absent: Files.write throws NoSuchFileException first, so the user gets a file-not-found error instead of the intended "unsupported version" message.

The line is removed; the exception which follows still reports the unsupported version.

Measured against the CMI IIx library images (-s CMI3 -d WAV -a), running from the working directory:

files created voices analysed unsupported-version errors
before 76 1154 4
after 0 1154 4

Standard output and error output are byte-identical to a build of current main, so nothing but the stray writes changes.

Reading a Voice file whose version is not recognized wrote a copy of that
file to "C:\Users\mos\Desktop\Output" before reporting the error - leftover
debug output which shipped.

On Windows it silently fills that folder on the one machine which has it and,
where it does not exist, the resulting NoSuchFileException replaces the
intended 'unsupported version' message with a confusing file-not-found error.
On macOS and Linux a backslash is an ordinary file name character, so the
whole path becomes the name of a file created in the current working
directory: analysing the CMI IIx library images drops 76 such files next to
whatever the user happened to be working in.

Analysing a source is expected to write nothing, which now holds again. The
unsupported version is still reported by the exception which follows.

Verified against the CMI IIx library images: unpatched, 76 files appear in
the working directory; with this change none do, the same 1154 voices are
analysed and the 4 unsupported-version errors are reported unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant