Skip to content

fix: Special table owns readdir merge and write-redirect paths - #99

Merged
davydog187 merged 2 commits into
mainfrom
cursor/fs-special-nits-9e47
Aug 23, 2026
Merged

fix: Special table owns readdir merge and write-redirect paths#99
davydog187 merged 2 commits into
mainfrom
cursor/fs-special-nits-9e47

Conversation

@davydog187

@davydog187 davydog187 commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Leftover nits from #93 / #78 (JustBash.FS.Special). The special-file table is the right layer; these edges were still using a drive-by sort and a literal /dev/null match.

Changes

  • Special.merge_children/2 only uniq-sorts when children(path) is non-empty. Ordinary FS.readdir/2 / ls order is the backend's again.
  • Write redirects classify through Special.null?/1 after FS.resolve_path/2, so > /dev/./null is the same node as > /dev/null and skips Limit.check_file_size!. exec/2 still returns a shell result.
  • Trailing-slash spellings (> /dev/null/) stay on the ordinary open path (bash: not a directory).
  • No character-device type. test -f /dev/null remains true (VFS.Stat is still :regular).

Out of scope (investigated, not changed)

  • ln -s /dev/null /link succeeds; cat /link is ENOENT. Special lookup is on the operand path, not after symlink follow, so the VFS backend sees no node.
  • mv /dev/null /out is still cp-then-rm. rm is :eacces; the failed with drops the copied fs, so /out is not left behind. GNU rename fails without attempting the copy. Same user-visible result, different mechanism.
  • test -f /dev/null is true. A char-device type is not needed for the two nits above.

Related Issues

Fixes #94

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

Testing

  • Added new tests
    • FS.readdir/2 of an unrelated dir preserves backend order (stream backend; VFS already sorts bounded lists)
    • merge_children/2 only sorts / and /dev
    • > /dev/./null with a payload over max_file_bytes exits 0 and does not raise
  • All existing tests pass (mix test: 2 doctests, 62 properties, 5493 tests, 0 failures)
  • mix compile --warnings-as-errors, mix format --check-formatted, mix credo, mix dialyzer, mix docs --warnings-as-errors

Checklist

  • My code follows the style guidelines of this project
  • I have run mix format
  • I have run mix credo and addressed any issues
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • I have updated the documentation accordingly
  • I have updated the CHANGELOG.md (for non-trivial changes)
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 22, 2026 00:01
Only uniq-sort directories that contribute Special children, and classify
write redirects with Special.null?/1 after normalize so > /dev/./null
skips the file-size cap. exec/2 still returns a shell result.

Co-authored-by: Dave Lucia <davelucianyc@gmail.com>
VFS uniq-sorts bounded list listings, so a list fixture could not
show whether Special.merge_children/2 re-sorted an unrelated directory.

Co-authored-by: Dave Lucia <davelucianyc@gmail.com>
@davydog187
davydog187 marked this pull request as ready for review August 22, 2026 00:06
@davydog187
davydog187 merged commit 05a26b2 into main Aug 23, 2026
4 checks passed
This was referenced Aug 21, 2026
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.

FS.Special nits after #78: readdir sort, write-redirect path, no char-device type

2 participants