Skip to content

Fix os9 copy exit status and add regression coverage - #89

Merged
DrPitre merged 1 commit into
nitros9project:mainfrom
tlindner:feature/os9-copy-exit-status
Oct 29, 2026
Merged

DrPitre merged 1 commit into
nitros9project:mainfrom
tlindner:feature/os9-copy-exit-status

Conversation

@tlindner

Copy link
Copy Markdown
Member

os9 copy printed errors from TSCopyFile but unconditionally returned zero, so callers and scripts could not distinguish a failed copy from success. Returning only the last copy result would also hide an earlier failure when processing multiple sources.

Track the first nonzero copy error in os9/os9copy.c and return it after processing all sources and freeing the copy buffer. Continue attempting remaining sources so a missing file does not prevent valid files from being copied.

Add test_os9_command_copy_exit_status in unittest/os9commandtest.c using a self-contained OS-9 disk image and native source fixture. Verify:

  • Successful copies exit with zero.
  • Missing sources return EOS_PNNF.
  • Existing destinations without -r return EOS_FAE.
  • Multi-source failures remain visible before or after a successful copy.
  • A valid source following a failed source is copied with exact contents.

Validation:

  • Confirmed the regression failed before the fix: a missing source incorrectly returned exit status zero.
  • make -C build/unix succeeded; all 55 tests passed.
  • git diff --check passed.

os9 copy printed errors from TSCopyFile but unconditionally returned zero,
so callers and scripts could not distinguish a failed copy from success.
Returning only the last copy result would also hide an earlier failure
when processing multiple sources.

Track the first nonzero copy error in os9/os9copy.c and return it after
processing all sources and freeing the copy buffer. Continue attempting
remaining sources so a missing file does not prevent valid files from
being copied.

Add test_os9_command_copy_exit_status in unittest/os9commandtest.c using a
self-contained OS-9 disk image and native source fixture. Verify:
- Successful copies exit with zero.
- Missing sources return EOS_PNNF.
- Existing destinations without -r return EOS_FAE.
- Multi-source failures remain visible before or after a successful copy.
- A valid source following a failed source is copied with exact contents.

Validation:
- Confirmed the regression failed before the fix: a missing source
  incorrectly returned exit status zero.
- make -C build/unix succeeded; all 55 tests passed.
- git diff --check passed.
@DrPitre
DrPitre merged commit 11c4bbc into nitros9project:main Oct 29, 2026
6 checks passed
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.

2 participants