Skip to content

os9: bugs fixed - #100

Merged
DrPitre merged 4 commits into
nitros9project:mainfrom
tlindner:os9-real-disk
Nov 2, 2026
Merged

DrPitre merged 4 commits into
nitros9project:mainfrom
tlindner:os9-real-disk

Conversation

@tlindner

@tlindner tlindner commented Nov 2, 2026

Copy link
Copy Markdown
Member

os9 free: overstated the largest free block, because its run counter only reset when a run set a new maximum.
os9 dir -e: stopped listing silently, with exit status 0, at a file with no permissions.
os9 fstat and _os9_gs_fd_pathlist: refused to read the file descriptor of a file with no permissions.
os9 file writes: could add a 48th segment, which OS-9 refuses to create with E$SLF.
os9 del: left a cluster allocated when a file’s segment started partway through a cluster, as RBF’s first segments do on disks with larger clusters.
File truncation in librbf: kept more sectors than RBF does when a file’s first segment started partway through a cluster.
os9 dcheck segment loops: read past the file descriptor on a full 48-segment list and wrongly reported the disk as not intact.
os9 dcheck bitmap: allocated its secondary bitmap a byte short, so leftover heap memory could make it report a good disk as not intact.

tlindner and others added 4 commits November 1, 2026 18:33
Add "os9 files mame.dmk" and "os9 clusters mame.dmk", written by OS-9 Level Two
under MAME. Files hold a pattern that tests can recompute, and what the tests
expect of directories, segments and free space is what OS-9 itself reported.
Comments in librbftest.c describe how each disk was made.

The first has edge sizes, fragmented files, a file at the segment limit, deleted
and reused directory slots, a directory with two segments, and a range of
attributes and names. The second has 2-sector clusters.

Fix what they found:

os9 free overstated the largest free block, since the run counter only reset
when a run set a new maximum.

os9 dir -e stopped silently at a file with no permissions. It now reads the file
descriptor by LSN, and reports one it cannot read, with a failing exit status.
os9 fstat and _os9_gs_fd_pathlist now read that file too.

Writing could add a 48th segment, where RBF refuses with E$SLF.

Deleting a file lost a cluster when a segment started inside one, as RBF's first
segments do. Truncating kept more than RBF does on such a file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
OS-9 stops a file at 47 segments, but follows a 48th if a disk has one, and its
dcheck says such a disk is intact. Ours read past the file descriptor for a 49th
segment, and reported a bad one.

Test files with a 48th segment against what Tandy's OS-9 did with one. It read
the file back and refused to add a sector with E$SLF. Its del leaves the 48th
segment allocated, where ours frees it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GCC's format-truncation warning stopped the Linux build at this snprintf. A
pathlist too long would have opened the wrong file, so fail the test instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The secondary bitmap was a byte short whenever the sector count was not one less
than a multiple of 8, so the last sectors were tracked past the end of it, in
memory that was not cleared. On Linux that made dcheck report disks with free
sectors there as not intact.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@DrPitre
DrPitre merged commit 76fc7bf into nitros9project:main Nov 2, 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