From: "jeremyevans0 (Jeremy Evans) via ruby-core" Date: 2023-04-03T21:01:43+00:00 Subject: [ruby-core:113094] [Ruby master Bug#19441] Closing an Tempfile#dup behaviour Issue #19441 has been updated by jeremyevans0 (Jeremy Evans). I think this is a bug in `Tempfile#{dup,clone}` that we should fix. I submitted a pull request for it: https://github.com/ruby/tempfile/pull/17 ---------------------------------------- Bug #19441: Closing an Tempfile#dup behaviour https://bugs.ruby-lang.org/issues/19441#change-102631 * Author: stac47 (Laurent Stacul) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.1 (2023-02-08 revision 31819e82c8) [x86_64-darwin20] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Hello amazing ruby folks! I classified that ticket as a "Bug" although it is perhaps something I did not understand. Here is a ruby session: ``` ruby irb(main):001:0> file = Tempfile.new => # irb(main):002:0> file.fileno => 9 irb(main):003:0> dup = file.dup => # irb(main):004:0> dup.fileno => 10 irb(main):005:0> dup.close => nil irb(main):006:0> dup.closed? => false irb(main):007:0> file.closed? => true ``` The two last lines are unexpected to me. I would have expected the converse: ```ruby irb(main):006:0> dup.closed? => true irb(main):007:0> file.closed? => false ``` I tried this scenario in latest ruby but also in ruby 2.7. Thanks in advance for helping me to understand this behaviour. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/