From e954de365f3eee3c76da5a19e2130ffc7deb43d0 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Mon, 16 Nov 2026 01:17:04 +0100 Subject: [PATCH] conformance: the two IO divergences the shutdown-flush work left behind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ruby#948 merged today and closed ruby#643: a file written and not closed reaches disk at interpreter teardown, like MRI's. Measured over 16 differential cases against MRI 4.0.7, 0 diverge. What it did NOT make go away is two residual divergences, and this page listed neither. Both have the same root as the `File#stat` row above them: a stream is buffered by PATH and holds no descriptor. - `IO#pwrite`'s bytes are not on disk until a flush, where MRI's `rb_io_pwrite` calls `pwrite(2)` and they are there the moment it returns. They are no longer LOST — teardown flushes them — so only the immediacy differs. ruby#949. - An unflushed file whose DIRECTORY is removed before the program ends loses its bytes, because teardown re-opens the path to flush it and gets `ENOENT`. MRI, holding a descriptor to an unlinked file, still writes them. Teardown reports nothing, as MRI's shutdown ignores a failing `fflush`. Same root as ruby#635. ⛔ The second one is a COST the fix accepted, not an oversight: the first version of the flush re-raised that `Errno`, which turned two EXISTING tests red (`Dir.mktmpdir` removes the directory under them). An error path added to teardown has nobody left to rescue it, so it has to fail silently — the one place where "a silent failure is worse than a loud one" is false. Stating it here is the whole point of the row. Gates run locally: gofmt clean, `go test ./...` green (6 packages), `conformancefigure --root content/en` reads 5 claims / 2 version claims at Ruby 4.0.9. No figure, example or method name changed. Co-Authored-By: Claude Opus 5 --- content/en/conformance.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/en/conformance.md b/content/en/conformance.md index 94fc4c9..5d84672 100644 --- a/content/en/conformance.md +++ b/content/en/conformance.md @@ -404,6 +404,8 @@ the call returns successfully and nothing says the guarantee is missing: | `Numeric#to_int` is not defined — `Complex(2.9, 0).to_int` raises `NoMethodError` where MRI returns `2` | [#631](https://github.com/go-embedded-ruby/ruby/issues/631) | | `File::Stat#==` answers identity: `a == b` is `false` for two stats of one file where MRI says `true` | [#632](https://github.com/go-embedded-ruby/ruby/issues/632) | | `File#stat` raises `Errno::ENOENT` for a file unlinked while open; MRI answers from the descriptor | [#635](https://github.com/go-embedded-ruby/ruby/issues/635) | +| `IO#pwrite` / `IO#pread` go through the buffer, not a descriptor, so a `#pwrite`'s bytes are not on disk until a flush — MRI's `rb_io_pwrite` calls `pwrite(2)` and they are there the moment it returns. They are no longer **lost**: interpreter teardown flushes them like any other buffered write ([#643](https://github.com/go-embedded-ruby/ruby/issues/643), merged 2026-11-16), so a program that `pwrite`s and exits finds them. Only the **immediacy** differs, and the root is the row above's: a stream is buffered by **path**, with no descriptor | [#949](https://github.com/go-embedded-ruby/ruby/issues/949) | +| An unflushed file whose **directory** is removed before the program ends loses its bytes; MRI, holding a descriptor to an unlinked file, still writes them. Teardown re-opens the path to flush it, so it gets `ENOENT` — and reports nothing, as MRI's shutdown ignores a failing `fflush`. Same root again | [#635](https://github.com/go-embedded-ruby/ruby/issues/635) | | Neither `Kernel#pp` nor `require "pp"` exists (`require "prettyprint"` works) | — | | **Windows:** no text-mode newline translation | [#610](https://github.com/go-embedded-ruby/ruby/issues/610) | | **Windows:** `File::Stat#atime`/`#ctime` fall back to mtime | [#635](https://github.com/go-embedded-ruby/ruby/issues/635) |