Skip to content

Fix native file I/O bugs and add regression coverage - #86

Merged
tlindner merged 1 commit into
nitros9project:mainfrom
tlindner:feature/libnative-regression-fixes
Oct 28, 2026
Merged

tlindner merged 1 commit into
nitros9project:mainfrom
tlindner:feature/libnative-regression-fixes

Conversation

@tlindner

Copy link
Copy Markdown
Member
  • libnative/libnativereadln.c:46: include the converted newline in the returned byte count, including empty lines and full buffers.
  • libnative/libnativeopen.c:187: open write-only files with O_WRONLY and fdopen without truncating, appending, creating missing files, or requiring read permission; preserve binary mode on Windows and close descriptors on fdopen failure.
  • libnative/libnativeseek.c:21: propagate fseek failures through UnixToCoCoError instead of reporting success.
  • libnative/libnativerename.c:21: allocate a terminated destination path, preserve the directory prefix, and return rename errors before freeing the buffer.
  • unittest/libnativetest.c:46,71,125,156,180,202: add ten TinyTest cases covering line counts, EOF, write-only opens, failed seeks, missing rename sources, and in-directory renames.
  • build/unix/unittest/Makefile:24,34: build and run libnativetest in the standard suite; .gitignore:23: ignore its generated executable.

Confirmed each primary regression failed before its fix. Validation: make -C build/unix passes all 42 tests; git diff --check passes.

- libnative/libnativereadln.c:46: include the converted newline in the returned byte count, including empty lines and full buffers.
- libnative/libnativeopen.c:187: open write-only files with O_WRONLY and fdopen without truncating, appending, creating missing files, or requiring read permission; preserve binary mode on Windows and close descriptors on fdopen failure.
- libnative/libnativeseek.c:21: propagate fseek failures through UnixToCoCoError instead of reporting success.
- libnative/libnativerename.c:21: allocate a terminated destination path, preserve the directory prefix, and return rename errors before freeing the buffer.
- unittest/libnativetest.c:46,71,125,156,180,202: add ten TinyTest cases covering line counts, EOF, write-only opens, failed seeks, missing rename sources, and in-directory renames.
- build/unix/unittest/Makefile:24,34: build and run libnativetest in the standard suite; .gitignore:23: ignore its generated executable.

Confirmed each primary regression failed before its fix. Validation: make -C build/unix passes all 42 tests; git diff --check passes.
@tlindner
tlindner merged commit b7ae641 into nitros9project:main Oct 28, 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.

1 participant