ml.ruby-lang.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

ruby-core

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
ruby-core@ml.ruby-lang.org

  • 5 participants
  • 3280 discussions
[ruby-core:111354] [Ruby master Feature#19078] Introduce `Fiber#storage` for inheritable fiber-scoped variables.
by Eregon (Benoit Daloze) 20 Dec '22

20 Dec '22
Issue #19078 has been updated by Eregon (Benoit Daloze). Fixes for the above are in https://github.com/ruby/ruby/pull/6972 > Also there is no experimental warning or anything as matz has asked. There is some mention in the docs, but I think that's not enough, especially for `Fiber#storage=` so I added an experimental warning there. ---------------------------------------- Feature #19078: Introduce `Fiber#storage` for inheritable fiber-scoped variables. https://bugs.ruby-lang.org/issues/19078#change-100729 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- Pull Request: https://github.com/ruby/ruby/pull/6612 This is an evolution of the previous ideas: - https://bugs.ruby-lang.org/issues/19058 - https://bugs.ruby-lang.org/issues/19062 This PR introduces fiber scoped variables, and is a solution for problems like <https://github.com/ioquatix/ioquatix/discussions/17>. The main interface is: ```ruby Fiber[key] = value Fiber[key] # => value ``` The variables are scoped (local to) a fiber and inherited into child fibers and threads. ```ruby Fiber[:request_id] = SecureRandom.hex(16) Fiber.new do p Fiber[:request_id] # prints the above request id end ``` The fiber scoped variables are stored and can be accessed: ```ruby Fiber.current.storage # => returns a Hash (copy) of the internal storage. Fiber.current.storage= # => assigns a Hash (copy) to the internal storage. ``` Fiber itself has one new keyword argument: ``` Fiber.new(..., storage: hash, false, undef, nil) ``` This can control how the fiber variables are setup in a child context. To minimise the performance overhead of some of the implementation choices, we are also simultaneously implementing <https://bugs.ruby-lang.org/issues/19077>. ## Examples ### Request loop ```ruby Thread.new do while request = queue.pop Fiber.new(storage: {id: SecureRandom.hex(16)}) do handle_request.call(request) end end end ``` OR ```ruby Thread.new do while request = queue.pop Fiber.current.storage = {id: SecureRandom.hex(16)} handle_request.call(request) end end ``` -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111353] [Ruby master Feature#19078] Introduce `Fiber#storage` for inheritable fiber-scoped variables.
by Eregon (Benoit Daloze) 20 Dec '22

20 Dec '22
Issue #19078 has been updated by Eregon (Benoit Daloze). matz (Yukihiro Matsumoto) wrote in #note-22: > (4) Fiber.new(...,storage: hash|true|false|nil) - accepted, but true/false should be experimental > The feature (4) with true/false are hard to read the intention (true to inherit with dup, false to inherit without dup), so we need experiment here as well. `false` is a violation of everything we discussed (with @byroot etc). It means no more isolation between Fibers, and setting a variable accidentally changes other Fiber storages, leading to tons of confusion. I believe no language does this for very good reasons. I don't know when you added this @ioquatix but that is an unacceptable change to the design long discussed. Also there is no experimental warning or anything as matz has asked. I will remove `storage: false` now, this is the only safe thing to do before the release. Also this is a necessary condition to avoid synchronization on Fiber[]/Fiber[]= for non-GIL Rubies. BTW, Fiber#storage and Fiber#storage= do not check which thread calls them. But a different thread should of course never be allowed to reassign the storage of a Fiber it doesn't belong to. Accessing it also feels wrong. ---------------------------------------- Feature #19078: Introduce `Fiber#storage` for inheritable fiber-scoped variables. https://bugs.ruby-lang.org/issues/19078#change-100727 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- Pull Request: https://github.com/ruby/ruby/pull/6612 This is an evolution of the previous ideas: - https://bugs.ruby-lang.org/issues/19058 - https://bugs.ruby-lang.org/issues/19062 This PR introduces fiber scoped variables, and is a solution for problems like <https://github.com/ioquatix/ioquatix/discussions/17>. The main interface is: ```ruby Fiber[key] = value Fiber[key] # => value ``` The variables are scoped (local to) a fiber and inherited into child fibers and threads. ```ruby Fiber[:request_id] = SecureRandom.hex(16) Fiber.new do p Fiber[:request_id] # prints the above request id end ``` The fiber scoped variables are stored and can be accessed: ```ruby Fiber.current.storage # => returns a Hash (copy) of the internal storage. Fiber.current.storage= # => assigns a Hash (copy) to the internal storage. ``` Fiber itself has one new keyword argument: ``` Fiber.new(..., storage: hash, false, undef, nil) ``` This can control how the fiber variables are setup in a child context. To minimise the performance overhead of some of the implementation choices, we are also simultaneously implementing <https://bugs.ruby-lang.org/issues/19077>. ## Examples ### Request loop ```ruby Thread.new do while request = queue.pop Fiber.new(storage: {id: SecureRandom.hex(16)}) do handle_request.call(request) end end end ``` OR ```ruby Thread.new do while request = queue.pop Fiber.current.storage = {id: SecureRandom.hex(16)} handle_request.call(request) end end ``` -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111352] [Ruby master Feature#19000] Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
by Eregon (Benoit Daloze) 20 Dec '22

20 Dec '22
Issue #19000 has been updated by Eregon (Benoit Daloze). k0kubun (Takashi Kokubun) wrote in #note-37: > +1. I'm not sure if it's possible to distinguish them in Ruby, but ideally `data.with` or `data.with()` should be rejected even if we accept `data.with(**changes)` when `changes` are empty. That's not possible to differentiate and also it shouldn't be (it would be very confusing if it was different). > If it's feasible, then it might clear Matz's concern at #note-27. @matz Is it really that big a concern? I think it's far far more important that `with(**changes)` works, whether `changes` is empty or not. Honestly I think there is no point to prevent that, it's necessary for the `with(**changes)` use case and it seems pretty much harmless. ---------------------------------------- Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object] https://bugs.ruby-lang.org/issues/19000#change-100726 * Author: RubyBugs (A Nonymous) * Status: Open * Priority: Normal ---------------------------------------- *As requested: extracted a follow-up to #16122 Data: simple immutable value object from [this comment](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/109815)* # Proposal: Add a "Copy with changes" method to Data Assume the proposed `Data.define` exists. Seeing examples from the [[Values gem]](https://github.com/ms-ati/Values): ```ruby require "values" # A new class Point = Value.new(:x, :y) # An immutable instance Origin = Point.with(x: 0, y: 0) # Q: How do we make copies that change 1 or more values? right = Origin.with(x: 1.0) up = Origin.with(y: 1.0) up_and_right = right.with(y: up.y) # In loops movements = [ [ :x, +0.5 ], [ :x, +0.5 ], [ :y, -1.0 ], [ :x, +0.5 ], ] # position = Point(x: 1.5, y: -1.0) position = movements.inject(Origin) do |p, (field, delta)| p.with(field => p.send(field) + delta) end ``` ## Proposed detail: Call this method: `#with` ```ruby Money = Data.define(:amount, :currency) account = Money.new(amount: 100, currency: 'USD') transactions = [+10, -5, +15] account = transactions.inject(account) { |a, t| a.with(amount: a.amount + t) } #=> Money(amount: 120, currency: "USD") ``` ## Why add this "Copy with changes" method to the Data simple immutable value class? Called on an instance, it returns a new instance with only the provided parameters changed. This API affordance is now **widely adopted across many languages** for its usefulness. Why is it so useful? Because copying immutable value object instances, with 1 or more discrete changes to specific fields, is the proper and ubiquitous pattern that takes the place of mutation when working with immutable value objects. **Other languages** C# Records: “immutable record structs — Non-destructive mutation” — is called `with { ... }` https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-t… Scala Case Classes — is called `#copy` https://docs.scala-lang.org/tour/case-classes.html Java 14+ Records — Brian Goetz at Oracle is working on adding a with copy constructor inspired by C# above as we speak, likely to be called `#with` https://mail.openjdk.org/pipermail/amber-spec-experts/2022-June/003461.html Rust “Struct Update Syntax” via `..` syntax in constructor https://doc.rust-lang.org/book/ch05-01-defining-structs.html#creating-insta… ## Alternatives Without a copy-with-changes method, one must construct entirely new instances using the constructor. This can either be (a) fully spelled out as boilerplate code, or (b) use a symmetrical `#to_h` to feed the keyword-args constructor. **(a) Boilerplate using constructor** ```ruby Point = Data.define(:x, :y, :z) Origin = Point.new(x: 0.0, y: 0.0, z: 0.0) change = { z: -1.5 } # Have to use full constructor -- does this even work? point = Point.new(x: Origin.x, y: Origin.y, **change) ``` **(b) Using a separately proposed `#to_h` method and constructor symmetry** ```ruby Point = Data.define(:x, :y, :z) Origin = Point.new(x: 0.0, y: 0.0, z: 0.0) change = { z: -1.5 } # Have to use full constructor -- does this even work? point = Point.new(**(Origin.to_h.merge(change))) ``` Notice that the above are not ergonomic -- leading so many of our peer language communities to adopt the `#with` method to copy an instance with discrete changes. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111351] [Ruby master Feature#19078] Introduce `Fiber#storage` for inheritable fiber-scoped variables.
by lloeki (Loic Nageleisen) 20 Dec '22

20 Dec '22
Issue #19078 has been updated by lloeki (Loic Nageleisen). for the sake of thoroughness the nodejs one above was inspired by .Net https://learn.microsoft.com/en-us/dotnet/api/system.threading.asynclocal-1?… ---------------------------------------- Feature #19078: Introduce `Fiber#storage` for inheritable fiber-scoped variables. https://bugs.ruby-lang.org/issues/19078#change-100725 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- Pull Request: https://github.com/ruby/ruby/pull/6612 This is an evolution of the previous ideas: - https://bugs.ruby-lang.org/issues/19058 - https://bugs.ruby-lang.org/issues/19062 This PR introduces fiber scoped variables, and is a solution for problems like <https://github.com/ioquatix/ioquatix/discussions/17>. The main interface is: ```ruby Fiber[key] = value Fiber[key] # => value ``` The variables are scoped (local to) a fiber and inherited into child fibers and threads. ```ruby Fiber[:request_id] = SecureRandom.hex(16) Fiber.new do p Fiber[:request_id] # prints the above request id end ``` The fiber scoped variables are stored and can be accessed: ```ruby Fiber.current.storage # => returns a Hash (copy) of the internal storage. Fiber.current.storage= # => assigns a Hash (copy) to the internal storage. ``` Fiber itself has one new keyword argument: ``` Fiber.new(..., storage: hash, false, undef, nil) ``` This can control how the fiber variables are setup in a child context. To minimise the performance overhead of some of the implementation choices, we are also simultaneously implementing <https://bugs.ruby-lang.org/issues/19077>. ## Examples ### Request loop ```ruby Thread.new do while request = queue.pop Fiber.new(storage: {id: SecureRandom.hex(16)}) do handle_request.call(request) end end end ``` OR ```ruby Thread.new do while request = queue.pop Fiber.current.storage = {id: SecureRandom.hex(16)} handle_request.call(request) end end ``` -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111348] [Ruby master Feature#19078] Introduce `Fiber#storage` for inheritable fiber-scoped variables.
by lloeki (Loic Nageleisen) 20 Dec '22

20 Dec '22
Issue #19078 has been updated by lloeki (Loic Nageleisen). This is really nice for some use cases, and I was planning to propose basically exactly what @ioquatix proposed here to tackle these. One example: we create context objects that allow us to track what happens across a given HTTP request execution. Typically with Rack we can store that in the Rack environment, but it so happens that elements we instrument via module prepending may not have access to the Rack environment. To get the context we then have to store that context object in a thread local (which is actually fiber local). The consequence is that if some bit code then goes async/concurrent (another thread or fiber) then context is (of course) lost. This would allow to keep the context within which we want to track things. As it turns out one of our team members from Sqreen implemented AsyncLocalContext which is incredibly similar in its purpose: https://nodejs.org/api/async_context.html Another example: [Rails is doing unhappy things to thread locals](https://github.com/rails/rails/blob/1512cf2ba578282c898b8eb68ac401e… when using `ActionController::Live`: it blindly copies thread locals to the new thread in an attempt to have the new thread behave like the old one. This is not good as it assumes none of these thread locals would be concurrently accessed or mutated, when by design thread locals are supposed to be, well, local to threads, thus can eschew thread safetiness safe nets. With this feature, Rails may be in a position to use it for what it needs and maybe stop its blind copying. ---------------------------------------- Feature #19078: Introduce `Fiber#storage` for inheritable fiber-scoped variables. https://bugs.ruby-lang.org/issues/19078#change-100722 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- Pull Request: https://github.com/ruby/ruby/pull/6612 This is an evolution of the previous ideas: - https://bugs.ruby-lang.org/issues/19058 - https://bugs.ruby-lang.org/issues/19062 This PR introduces fiber scoped variables, and is a solution for problems like <https://github.com/ioquatix/ioquatix/discussions/17>. The main interface is: ```ruby Fiber[key] = value Fiber[key] # => value ``` The variables are scoped (local to) a fiber and inherited into child fibers and threads. ```ruby Fiber[:request_id] = SecureRandom.hex(16) Fiber.new do p Fiber[:request_id] # prints the above request id end ``` The fiber scoped variables are stored and can be accessed: ```ruby Fiber.current.storage # => returns a Hash (copy) of the internal storage. Fiber.current.storage= # => assigns a Hash (copy) to the internal storage. ``` Fiber itself has one new keyword argument: ``` Fiber.new(..., storage: hash, false, undef, nil) ``` This can control how the fiber variables are setup in a child context. To minimise the performance overhead of some of the implementation choices, we are also simultaneously implementing <https://bugs.ruby-lang.org/issues/19077>. ## Examples ### Request loop ```ruby Thread.new do while request = queue.pop Fiber.new(storage: {id: SecureRandom.hex(16)}) do handle_request.call(request) end end end ``` OR ```ruby Thread.new do while request = queue.pop Fiber.current.storage = {id: SecureRandom.hex(16)} handle_request.call(request) end end ``` -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111338] [Ruby master Feature#19000] Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
by k0kubun (Takashi Kokubun) 20 Dec '22

20 Dec '22
Issue #19000 has been updated by k0kubun (Takashi Kokubun). Summary of the discussion so far: * Interface * `data.xxx(foo: bar)`, making `data.xxx` (no argument) an error * Matz #note-27 is in favor of this. * This might make dynamic use of this API harder #note-29 * `data.xxx(foo: bar)`, making `data.xxx` (no argument) not an error * `data.xxx(foo) { bar }` #note-27 * Method name * `with` * Proposal: [Feature #19000] by @RubyBugs * Other languages: C#, Java (WIP), * Existing gems: sorbet, value_semantics * Pull request: https://github.com/ruby/ruby/pull/6766 * Matz #note-25 said it's acceptable. * `update` * Proposal: #note-25 * Matz #note-25 liked this, but ko1 didn't. * `dup` * Proposal: #note-4 by @ufuk * Matz #note-25 said it's not acceptable. * `copy` * Proposal: #note-29 by @RubyBugs * Other languages: Scala, Kotlin * `clone` * Proposal: #note-5 by @jeremyevans0 * Existing gems: sequel * Alternatives * `Point.new(foo: Origin.foo, **change)` * `Point.new(**(Origin.to_h.merge(change)))` * `Point.new(**Origin.to_h, **change)` * Suggested at the Ruby developers' meeting in November --- My personal notes: I'm late to the party, but in my experience of using data classes in other languages, this feels like a must-have for data classes. It'd be unfortunate if Data were released without it. > > Also, do you need the ability to update multiple fields at once? Both motivation examples only update a single field. > > Yes! Definitely need to update multiple fields at once I second that. In my previous company, we had an immutable class that represents a state/snapshot for stream-processing multiple events at once (with Amazon Kinesis). It groups multiple events and dispatches a batch operation when a certain threshold is met. Because we had multiple thresholds (e.g. max size, max duration), we naturally needed to create a copy with multiple updates when we create the next state. > I also agree the 0-kwargs case should be supported for general use like data.with(**changes), whether changes is empty or not. And that reads fine of course. > It's also like Hash#merge with no arguments. +1. I'm not sure if it's possible to distinguish them in Ruby, but ideally `data.with` or `data.with()` should be rejected even if we accept `data.with(**changes)`. If it's feasible, then it might clear Matz's concern at #note-27. ---------------------------------------- Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object] https://bugs.ruby-lang.org/issues/19000#change-100714 * Author: RubyBugs (A Nonymous) * Status: Open * Priority: Normal ---------------------------------------- *As requested: extracted a follow-up to #16122 Data: simple immutable value object from [this comment](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/109815)* # Proposal: Add a "Copy with changes" method to Data Assume the proposed `Data.define` exists. Seeing examples from the [[Values gem]](https://github.com/ms-ati/Values): ```ruby require "values" # A new class Point = Value.new(:x, :y) # An immutable instance Origin = Point.with(x: 0, y: 0) # Q: How do we make copies that change 1 or more values? right = Origin.with(x: 1.0) up = Origin.with(y: 1.0) up_and_right = right.with(y: up.y) # In loops movements = [ [ :x, +0.5 ], [ :x, +0.5 ], [ :y, -1.0 ], [ :x, +0.5 ], ] # position = Point(x: 1.5, y: -1.0) position = movements.inject(Origin) do |p, (field, delta)| p.with(field => p.send(field) + delta) end ``` ## Proposed detail: Call this method: `#with` ```ruby Money = Data.define(:amount, :currency) account = Money.new(amount: 100, currency: 'USD') transactions = [+10, -5, +15] account = transactions.inject(account) { |a, t| a.with(amount: a.amount + t) } #=> Money(amount: 120, currency: "USD") ``` ## Why add this "Copy with changes" method to the Data simple immutable value class? Called on an instance, it returns a new instance with only the provided parameters changed. This API affordance is now **widely adopted across many languages** for its usefulness. Why is it so useful? Because copying immutable value object instances, with 1 or more discrete changes to specific fields, is the proper and ubiquitous pattern that takes the place of mutation when working with immutable value objects. **Other languages** C# Records: “immutable record structs — Non-destructive mutation” — is called `with { ... }` https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-t… Scala Case Classes — is called `#copy` https://docs.scala-lang.org/tour/case-classes.html Java 14+ Records — Brian Goetz at Oracle is working on adding a with copy constructor inspired by C# above as we speak, likely to be called `#with` https://mail.openjdk.org/pipermail/amber-spec-experts/2022-June/003461.html Rust “Struct Update Syntax” via `..` syntax in constructor https://doc.rust-lang.org/book/ch05-01-defining-structs.html#creating-insta… ## Alternatives Without a copy-with-changes method, one must construct entirely new instances using the constructor. This can either be (a) fully spelled out as boilerplate code, or (b) use a symmetrical `#to_h` to feed the keyword-args constructor. **(a) Boilerplate using constructor** ```ruby Point = Data.define(:x, :y, :z) Origin = Point.new(x: 0.0, y: 0.0, z: 0.0) change = { z: -1.5 } # Have to use full constructor -- does this even work? point = Point.new(x: Origin.x, y: Origin.y, **change) ``` **(b) Using a separately proposed `#to_h` method and constructor symmetry** ```ruby Point = Data.define(:x, :y, :z) Origin = Point.new(x: 0.0, y: 0.0, z: 0.0) change = { z: -1.5 } # Have to use full constructor -- does this even work? point = Point.new(**(Origin.to_h.merge(change))) ``` Notice that the above are not ergonomic -- leading so many of our peer language communities to adopt the `#with` method to copy an instance with discrete changes. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111331] [Ruby master Bug#13298] mingw SEGV TestEnumerable#test_callcc
by ioquatix (Samuel Williams) 19 Dec '22

19 Dec '22
Issue #13298 has been updated by ioquatix (Samuel Williams). Status changed from Assigned to Closed I've merged https://github.com/ruby/ruby/pull/6957 which is similar to the above proposal. It fixes a repeatable segfault on my local Windows 11 development VM. ---------------------------------------- Bug #13298: mingw SEGV TestEnumerable#test_callcc https://bugs.ruby-lang.org/issues/13298#change-100708 * Author: MSP-Greg (Greg L) * Status: Closed * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) * ruby -v: ruby 2.5.0dev (2017-03-09 trunk 57821) [x64-mingw32] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- First week in January, when I first started building, I had a SEGV in test-all occurring in TestEnumerable#test_callcc. I patched around it, but decided it was time to see if I could find a solution. The issue occurs in [test/ruby/test_enum.rb:559-570](https://github.com/ruby/ruby/blob/d6873af4b…. Below is the code: ```ruby assert_raise(RuntimeError) do c = nil o = Object.new class << o; self; end.class_eval do define_method(:<=>) do |x| callcc {|c2| c ||= c2 } 0 end end [o, o].sort_by {|x| x } c.call end ``` While trying to determine the problem in a separate test environment, I stumbled across an odd solution. Add the line `c.to_s` immediately before the `c.call` line. My system no longer stops. I'd be happy to do a PR, but I can only test on Windows. Two questions -- 1. Might all of tests that involve `callcc` or `Continuation` be moved into another test file? Since it is considered 'obsolete'... I'd be happy to do. 2. Rather odd that this fixes the issue. Any ideas? ```diff --- test/ruby/test_enum.rb.orig Thu Mar 09 07:54:37 2017 +++ test/ruby/test_enum.rb Thu Mar 09 11:39:07 2017 @@ -568,2 +568,3 @@ [o, o].sort_by {|x| x } + c.to_s c.call ``` ---Files-------------------------------- test_enum_559.txt (10.6 KB) x64-mingw32-callcc-test.rb (434 Bytes) -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111326] [Ruby master Bug#19241] Ractor will change Windows System Power Mode
by jakit (Jakit Liang) 18 Dec '22

18 Dec '22
Issue #19241 has been reported by jakit (Jakit Liang). ---------------------------------------- Bug #19241: Ractor will change Windows System Power Mode https://bugs.ruby-lang.org/issues/19241 * Author: jakit (Jakit Liang) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- ## Problem Just start `irb`: ``` % irb irb(main):001:0> ``` And you can see Windows Power mode will change to `High Performance` ## Version `ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x64-mingw-ucrt]` And other version of 3.x also have this problem. ## Expected Please not change user's system settings. -- https://bugs.ruby-lang.org/
2 3
0 0
[ruby-core:111314] [Ruby master Bug#19239] miniruby is not built by default when cross-compiling ruby 3.2.0-rc1
by mdalessio (Mike Dalessio) 18 Dec '22

18 Dec '22
Issue #19239 has been reported by mdalessio (Mike Dalessio). ---------------------------------------- Bug #19239: miniruby is not built by default when cross-compiling ruby 3.2.0-rc1 https://bugs.ruby-lang.org/issues/19239 * Author: mdalessio (Mike Dalessio) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- When cross-compiling Ruby for darwin, the default make target doesn't build miniruby, even though it's needed for symbol resolution since https://github.com/ruby/ruby/commit/50d81bf A workaround is to run `make miniruby && make` but I'm opening this issue to discuss if something needs to be fixed. Here is a dockerfile that reproduces the issue: ```dockerfile FROM larskanis/rake-compiler-dock-mri-x86_64-darwin:1.2.2 RUN wget https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0-rc1.tar.gz RUN tar -zxf ruby-3.2.0-rc1.tar.gz ENV DEBIAN_FRONTEND noninteractive RUN apt-get -y update && \ apt-get install -y curl git-core xz-utils build-essential zlib1g-dev libreadline-dev libssl-dev wget unzip sudo gnupg2 dirmngr cmake pkg-config autoconf libyaml-dev ENV CC x86_64-apple-darwin-clang RUN bash -c " \ rvm use 3.1.0 && \ cd ruby-3.2.0-rc1 && \ ./configure \ --host=x86_64-apple-darwin \ --target=x86_64-apple-darwin \ --build=x86_64-pc-linux-gnu \ --disable-jit-support \ " RUN bash -c " \ rvm use 3.1.0 && \ cd ruby-3.2.0-rc1 && \ make V=1 \ " ``` Failure emits errors like this: ``` x86_64-apple-darwin-clang -dynamic -bundle -o ../../../.ext/x86_64-darwin/-test-/RUBY_ALIGNOF.bundle c.o cpp.o -L. -L../../.. -L. -fstack-protector-strong -Wl,-multiply_defined,suppress -Wl,-undefined,dynamic_lookup -bundle_loader '../../../miniruby' -lpthread ld: file not found: ../../../miniruby clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: Leaving directory '/ruby-3.2.0-rc1/ext/-test-/RUBY_ALIGNOF' make[2]: *** [Makefile:271: ../../../.ext/x86_64-darwin/-test-/RUBY_ALIGNOF.bundle] Error 1 make[1]: Leaving directory '/ruby-3.2.0-rc1' make[1]: *** [exts.mk:100: ext/-test-/RUBY_ALIGNOF/all] Error 2 make: *** [uncommon.mk:330: build-ext] Error 2 ``` The error stems from the LD flag `-bundle_loader '$(BUILTRUBY)'` which points at `miniruby`, even though `miniruby` has not been built. Replacing the last command with this will successfully build Ruby: ```dockerfile RUN bash -c " \ rvm use 3.1.0 && \ cd ruby-3.2.0-rc1 && \ make miniruby V=1 && \ make V=1 \ " ``` This is also happening on master HEAD. cc @katei and @alanwu who seem to be familiar with the `bundle_loader` functionality. -- https://bugs.ruby-lang.org/
2 4
0 0
[ruby-core:111325] [Ruby master Bug#13298] mingw SEGV TestEnumerable#test_callcc
by ioquatix (Samuel Williams) 17 Dec '22

17 Dec '22
Issue #13298 has been updated by ioquatix (Samuel Williams). I also found that the `if (0)` is required in Ruby 3.2 in order to build locally in the Ruby Installler Dev Kit otherwise it crashes as indicated. ---------------------------------------- Bug #13298: mingw SEGV TestEnumerable#test_callcc https://bugs.ruby-lang.org/issues/13298#change-100702 * Author: MSP-Greg (Greg L) * Status: Assigned * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) * ruby -v: ruby 2.5.0dev (2017-03-09 trunk 57821) [x64-mingw32] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- First week in January, when I first started building, I had a SEGV in test-all occurring in TestEnumerable#test_callcc. I patched around it, but decided it was time to see if I could find a solution. The issue occurs in [test/ruby/test_enum.rb:559-570](https://github.com/ruby/ruby/blob/d6873af4b…. Below is the code: ```ruby assert_raise(RuntimeError) do c = nil o = Object.new class << o; self; end.class_eval do define_method(:<=>) do |x| callcc {|c2| c ||= c2 } 0 end end [o, o].sort_by {|x| x } c.call end ``` While trying to determine the problem in a separate test environment, I stumbled across an odd solution. Add the line `c.to_s` immediately before the `c.call` line. My system no longer stops. I'd be happy to do a PR, but I can only test on Windows. Two questions -- 1. Might all of tests that involve `callcc` or `Continuation` be moved into another test file? Since it is considered 'obsolete'... I'd be happy to do. 2. Rather odd that this fixes the issue. Any ideas? ```diff --- test/ruby/test_enum.rb.orig Thu Mar 09 07:54:37 2017 +++ test/ruby/test_enum.rb Thu Mar 09 11:39:07 2017 @@ -568,2 +568,3 @@ [o, o].sort_by {|x| x } + c.to_s c.call ``` ---Files-------------------------------- test_enum_559.txt (10.6 KB) x64-mingw32-callcc-test.rb (434 Bytes) -- https://bugs.ruby-lang.org/
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • ...
  • 328
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.