Repository navigation
Description
Two open class methods take a block and discard it, found by the derived
open-door ratchet added alongside this issue (TestEveryOpenDoorIsAccountedFor).
Both are binding surfaces, not MRI core, which is why nothing had asked.
Measured: the code ignores the block
| site | signature | what it does with a block |
|---|---|---|
internal/vm/augeas.go:71 (Augeas.open, and Augeas.create — the same open func) |
func(_ *VM, _ object.Value, args []object.Value, _ *Proc) |
nothing: the parameter is _ |
internal/vm/images.go:93 (Images::Image.open) |
func(vm *VM, _ object.Value, args []object.Value, _ *Proc) |
nothing: the parameter is _ |
Klass.open(…) { |x| … } therefore returns the handle, never runs the block, and
closes nothing — which is the shape that cost #916 its 27 hung library/net-http
files, and the shape #931 and #939 chased through the socket family. The other
seven inline open handlers in the package were read one by one in the same pass
and all honour their block (Dir, File, IO, StringIO, Net::FTP,
SQLite3::Database, bbolt), as do the six socket doors and Resolv::DNS once
#948's sibling fix lands.
⛔ What is NOT measured, and it is the whole decision
Whether the reference gems have a block form at all. Neither is installed on
the machine this was found on, so this is a reading of rbgo's source and nothing
else. Discarding a block is only a defect if the reference accepts one:
- ruby-augeas (hercules-team/ruby-augeas):
Augeas.createis documented as
yielding the handle and closing it when a block is given, andAugeas.openis
its alias — but that is recalled, not read, and recalling a library's
contract instead of citing its source is the mistake this repository keeps
paying for. It needs the gem'slib/augeas.rbin front of someone. Images::Image.openhas no obvious upstream: the API is modelled on this
org's owngo-images, and ruby-vips / MiniMagick spell the same operation
Vips::Image.new_from_file/MiniMagick::Image.open, neither of which yields.
So no block form may be correct here, and the fix would be to document that
rather than to add one.
What settles it
For each of the two, read the reference's own source and quote it:
gem contents augeas # then read lib/augeas.rb's self.create
Then either route the site through socketOpenWithBlock(cls, <the new fn>) — the
helper already in socket.go, which yields, closes through the class's own
#close and answers the block's value — or record in
internal/vm/testdata/open-doors.txt that the reference has no block form, with
the citation.
⚠ If socketOpenWithBlock is used, check the class's #close first: it closes
through that method, so a #close that raises turns every block form into that
exception. That is exactly what Resolv::DNS needed fixing for in the sibling
change — its #close was on the NotImplementedError list.
🤖 Generated with Claude Code
Prior art: priorart "Augeas.open and Images::Image.open discard the block they are given" at 2026-11-15 22:42 CET reported prior art; checked: priorart at 22:42 returned 776 entries, none about these two sites: #931 is TCPSocket.open (sockets), #939 (merged) fixed three socket doors and FILED the fourth (Resolv::DNS) which the sibling change fixes, #916 is the hang count those caused. The augeas hits are all Renovate dependency PRs. No entry covers a binding surface discarding its block outside the socket family.
Activity
testdata: the Augeas reference was READ, so the row may not say 'reca…
tannevaled commentedon Nov 15, 2026
The references are read. One half is settled, the other is not — and they must stop being treated alike
I filed this saying the reference contract was unverified and naming the command
that would settle it. That was 20 minutes of reading away, so here it is.
⛔
Augeas.openis a CONFIRMED defecthercules-team/ruby-augeas,lib/augeas.rb, read athttps://raw.githubusercontent.com/hercules-team/ruby-augeas/master/lib/augeas.rb:block_given?,yield aug, the block's value returned,aug.closein anensure. That issocketOpenWithBlock's contract to the letter — and the sameparameter list rbgo already has (
root,loadpath,flags). So this is not aquestion any more.
⛔ But the fix is TWO parts, which is why #951 did not make it one
rbgo's
Augeashas no#closeat all.git grep close internal/vm/augeas.gois empty. Consequences:
socketOpenWithBlockcloses throughcls.methods["close"]and skips it whenabsent, so routing
openthrough the helper today would yield and return theblock's value but close nothing — a block form that looks right and leaks
the handle.
aug.closewritten by hand in Ruby is aNoMethodError, which ruby-augeasusers have no reason to expect.
So
#closecomes first, and it needs go-augeas's handle API read — whetheraugeas.Open's value has aClose, and whether closing twice is safe, since thehelper's close must be idempotent. That is its own change, not a line in a test
PR.
⚠ A second divergence the same reading turned up, and I have NOT verified it
ruby-augeas's
createis not the same method asopen:An options hash, not
(root, loadpath, flags)— and it delegates toAugeas::Facade::createinlib/augeas/facade.rb, which I did not fetch.rbgo registers
createandopenas literally the same func(
augeas.go:77-78), with the positional signature. Whether MRI'screateaccepts the positional form at all is unread, so this is a lead, not a finding.
The doc comment says create's block form closes too, but a doc comment is a dated
claim like any other.
Images::Image.openmoves the OTHER way: unspecified, not a defectgo-ruby-images' README(
https://raw.githubusercontent.com/go-ruby-images/images/main/README.md, HTTP200) documents no Ruby
Image.openand no block form at all. It documents theGo library —
images.Open("photo.jpg"), a package-level call returning an image —and the
img.Open(2)it does show is a morphological opening, not a file opener.ruby-vips and MiniMagick spell this operation without a block
(
Vips::Image.new_from_file,MiniMagick::Image.open), neither yielding.So there is no evidence of a gap here, and quite possibly nothing to fix: the
work is to document that
Images::Image.opentakes no block, or to find thebinding's actual reference, which the README is not.
What this issue is now
#close, which is a real small change. Not a question.gem yield?" but "what is this binding's reference at all?".
internal/vm/testdata/open-doors.txtin #951 carries both rows with thatdistinction written into them, so the next reader does not have to guess which
kind of unknown each one is.
Refs #951, #931, #939
🤖 Generated with Claude Code
[-]Augeas.open and Images::Image.open discard the block they are given, and the reference contract is unverified[/-][+]Augeas.open discards its block: confirmed against ruby-augeas, blocked on a missing #close — and Images::Image.open has no known reference[/+]vm: derive the open doors instead of listing them, and wire the fourth (
tannevaled commentedon Nov 16, 2026
Correcting this issue: the Augeas half was never blocked
This issue, and the
testdata/open-doors.txtrow behind it, said the Augeas half could not be fixed:Both sentences are true. The conclusion drawn from them is not. I asked what
#closefrees — andgo-ruby-augeas's handle indeed exposes noClose— when the question is what#closemakes observable. Fromext/augeas/_augeas.c, now read:#closeanswersniland poisons the object; afterwards every method raisesSystemCallError, a second#closeincluded, becauseaug_handleruns beforeaug_close. In an in-memory tree there is nothing to free, so that is a flag plus a guard — and the guard has exactly one site, theselfaccessor all seventeen instance methods already go through. Nothing was needed from the dependency.#952 does it, and the block form with it.
A third divergence, which reading the reference turned up
createandopenwere the same positional native. The gem's are different functions:Augeas.createtakes an options hash, and three properties offacade.rb's singleopts.each_keypass are observable: a flag is armed by its key's presence and not its value, socreate(type_check: false)setsTYPE_CHECK;:root/:loadpathare excluded by a condition rather than removed; and validation and assembly share one pass, so the first offending key raises and the error depends on the caller's insertion order. All three are pinned in #952.⛔
Augeas.create("/root", "/lens", 5)was accepted before and is now aTypeError— breaking for this binding, so a MINOR bump below v1.What stays open here
The
Images::Image.openhalf only. It discards its block too, but it is not a known defect: go-ruby-images documents no RubyImage.openand no block form at all — it documents the Go library (images.Open("photo.jpg")) — and ruby-vips and MiniMagick both spell this operation without a block. What that half needs is a reference, not a patch. Until one is identified, "no block form" may be the contract to document rather than a gap to fill.And the gate that should have caught this was blind to it
TestEveryOpenDoorIsAccountedFor(#951) marked every derived door as seen,socketOpenWithBlockones included, and called a table row stale only when no door carried its key — asking "does this door still exist?" instead of "does this door still need a row?". So fixingAugeas.openmoved nothing: the test stayed green with the row still reading ⛔ CONFIRMED DEFECT about a repaired door.It was found by changing the code the gate watches and noticing the gate did not move, not by re-reading the gate. #952 pulls the verdict out into a pure function with its own seven-case control, one case being "a door FIXED into socketOpenWithBlock leaves its row stale".
🤖 Generated with Claude Code
[-]Augeas.open discards its block: confirmed against ruby-augeas, blocked on a missing #close — and Images::Image.open has no known reference[/-][+]Images::Image.open discards its block and has no known reference — the Augeas half was never blocked, see #952[/+]test(augeas): cover open's own arity guard, which the ratchet caught
vm(augeas): #close, the block form, and create's real signature (#952)