Repository navigation
go-serial v0.4.1
Date: 2026-11-15
Previous release: v0.4.0
Summary
The Windows Write returns an error with a short count, OpenBSD waits for I/O with select, and the README states what is tested on each platform. No exported identifier changes.
Changes
Fixes
- Windows:
Writereturned a short count with a nil error whenConfig.Timeoutpassed before all bytes were written. It now returns the count withErrTimeout, as ERRORS.md and the comment onErrTimeoutsaid. A short count with no time-out set comes with an error wrappingio.ErrShortWrite. Code that took a nil error as "all bytes sent" now sees the error; code that wrote the rest again after a short count getsErrTimeoutinstead and decides for itself. - Windows: a buffer longer than one
WriteFilecall takes (2^32-1 bytes) is written in several calls. Before,Writewrote the first part and returned its length with a nil error. - OpenBSD:
Read, and aWritethat had to wait for room, failed with "function not implemented". The wait calledpollby its system call number, and on OpenBSD Go'ssyscallpackage carries out such calls for ioctl only. The wait now usessyscall.Select, with the code the macOS backend uses. This is cross-compiled and vetted, not run on OpenBSD. A descriptor at or aboveFD_SETSIZE(1024) fails withEINVALthere, as on macOS.
Changed
- POSIX:
Openchecks that the opened path is a character device before it reads or changes a terminal setting. Any other file is refused with an error wrappingENOTTY. Such a path could not be opened as a port before either: it failed one step later, with the error of the termios call./dev/nulland other character devices that are not terminals fail at the termios call, as before.
Documentation
- README: a table with the level of each platform (tested over pseudo-terminals, tested without a port, built and not run) and a list of what is known not to work.
- SECURITY.md: the supported line is 0.4.x; new sections on what the library trusts, its resource use and its known limits.
- ARCHITECTURE.md describes the mutex and the wake pipe of v0.4.0; before, it said that production code holds no locks and that
Closemust not run during I/O. - TESTING.md: where each group of tests runs, and the lifecycle contract tests (rows L1 to L16) with what applies to
Port. - LIMITATIONS.md: the Windows port is opened exclusively and the POSIX ones are not; on Windows, port numbers above 9 need the form
\\.\COM10; what CI runs on macOS, Windows and the BSDs. The "Known defects" entry is gone: the macOS failure ofTestChaosOpenCloseChurnwas in the test. - CONTRIBUTING.md lists what
make checkruns.
Tests and CI
TestCloseUnblocksReadandTestCloseUnblocksWriteno longer sleep. They hold the call at an unexported hook and assert thatClosedoes not return, and leaves the descriptor open, until theReadorWritehas let go of it.TestChaosOpenCloseChurnfailed on current macOS: the tests opened/dev/ptmxfrom eight goroutines at once. The test helper now opens it from one at a time, and the channel that collects the errors holds them all.- CI vets every cross-build target, which compiles its test files, and builds NetBSD and OpenBSD too. A
windows-latestjob runs the tests that need no port. The nightly workflow runs the tests as a linux/386 binary. - The release workflow builds and tests go-modbus against the release commit before it creates the tag. go-canbus is not listed: its SocketCAN tests need a kernel with AF_CAN, which that job does not set up.