Skip to content

Fix three decb copy bugs and add regression coverage - #88

Merged
DrPitre merged 1 commit into
nitros9project:mainfrom
tlindner:feature/decb-copy-fixes
Oct 29, 2026
Merged

DrPitre merged 1 commit into
nitros9project:mainfrom
tlindner:feature/decb-copy-fixes

Conversation

@tlindner

Copy link
Copy Markdown
Member

Fix native directory destinations (decb/decbcopy.c:225). The directory-target branch previously populated the destination path only for image paths containing a comma, leaving host-directory targets empty. Join the host directory and source basename, handle an optional trailing slash, and reject paths that exceed the destination buffer. Regression: unittest/decbcommandtest.c:99 checks both directory forms and verifies the extracted binary file's exact size and contents.

Prevent silent empty copies with -l (decb/decbcopy.c:462). EOL translation handled native-to-CoCo and CoCo-to-native copies but skipped all writes for same-format endpoints while still reporting success. Only enter the translation path when crossing the native/CoCo boundary; otherwise perform a normal byte-for-byte write.
Regression: unittest/decbcommandtest.c:146 covers disk-to-disk and native-to-native copies, preserving CR, LF, and CRLF bytes.

Preserve empty-file metadata (decb/decbcopy.c:522, :534). Metadata copying and explicit file/data type overrides were inside the nonempty-data block, so empty files ignored options such as -3a and lost source metadata during disk-to-disk copies. Apply metadata independently of whether there are any data bytes to write.
Regression: unittest/decbcommandtest.c:200 verifies text-editor/ASCII metadata for an empty import and its subsequent disk-to-disk copy. Register all three regressions at unittest/decbcommandtest.c:246-248.

Validation:

  • Each new regression failed before its corresponding fix.
  • make -C build/unix succeeded; all 57 tests passed.
  • git diff --check passed.

Line references above refer to the resulting files in this commit.

Fix native directory destinations (decb/decbcopy.c:225).
The directory-target branch previously populated the destination path only
for image paths containing a comma, leaving host-directory targets empty.
Join the host directory and source basename, handle an optional trailing
slash, and reject paths that exceed the destination buffer.
Regression: unittest/decbcommandtest.c:99 checks both directory forms and
verifies the extracted binary file's exact size and contents.

Prevent silent empty copies with -l (decb/decbcopy.c:462).
EOL translation handled native-to-CoCo and CoCo-to-native copies but skipped
all writes for same-format endpoints while still reporting success.
Only enter the translation path when crossing the native/CoCo boundary;
otherwise perform a normal byte-for-byte write.
Regression: unittest/decbcommandtest.c:146 covers disk-to-disk and
native-to-native copies, preserving CR, LF, and CRLF bytes.

Preserve empty-file metadata (decb/decbcopy.c:522, :534).
Metadata copying and explicit file/data type overrides were inside the
nonempty-data block, so empty files ignored options such as -3a and lost
source metadata during disk-to-disk copies. Apply metadata independently
of whether there are any data bytes to write.
Regression: unittest/decbcommandtest.c:200 verifies text-editor/ASCII
metadata for an empty import and its subsequent disk-to-disk copy.
Register all three regressions at unittest/decbcommandtest.c:246-248.

Validation:
- Each new regression failed before its corresponding fix.
- make -C build/unix succeeded; all 57 tests passed.
- git diff --check passed.

Line references above refer to the resulting files in this commit.
@DrPitre
DrPitre merged commit d262964 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