Skip to content

fix(read-write): handle NetBSD fd limits - #768

Merged
gaborbernat merged 3 commits into
tox-dev:mainfrom
gaborbernat:fix-netbsd-read-write
Oct 5, 2026
Merged

gaborbernat merged 3 commits into
tox-dev:mainfrom
gaborbernat:fix-netbsd-read-write

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

NetBSD's default /dev/fd contains entries 0-63. Opening SQLite through a higher database descriptor fails. This fixes #766 by using a hard link in a private directory when the descriptor path is missing.

The link must match the inode opened without following symlinks. Keep it until SQLite closes, then remove it; construction failures remove it as well. Use the system temporary location so users with write access to the lock directory cannot replace the alias directory. The fallback requires the temporary location and database to share a filesystem.

I could not run this on native NetBSD.

NetBSD creates static /dev/fd entries only for descriptors 0-63. Use a
private hard link in the system temporary location for higher descriptors
and verify its inode before SQLite opens it. Remove the link after close
or a construction failure.

Match the offending path in the symlink test to accept NetBSD's EFTYPE
wording.

Fixes tox-dev#766
@gaborbernat gaborbernat added the bug label Oct 4, 2026
Reuse the database fixture across fallback checks and place fixtures
below their callers.
Windows and Android skip the descriptor fallback checks but still count
their unreachable paths toward coverage. Share the POSIX hard-link
capability between the skip gate and coverage exclusions.
@gaborbernat
gaborbernat merged commit 47f036d into tox-dev:main Oct 5, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.0.10: 2 test failures

1 participant