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

December 2022

  • 10 participants
  • 244 discussions
[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
[ruby-core:111324] [Ruby master Bug#13485] MinGW TestEnumerable#test_callcc SEGV info
by MSP-Greg (Greg L) 17 Dec '22

17 Dec '22
Issue #13485 has been updated by MSP-Greg (Greg L). Not sure about what/when/where, but this test is passing and there is no longer a patch in ruby-loco. Hence, ok to close. Sorry. ---------------------------------------- Bug #13485: MinGW TestEnumerable#test_callcc SEGV info https://bugs.ruby-lang.org/issues/13485#change-100701 * Author: MSP-Greg (Greg L) * Status: Open * Priority: Normal * ruby -v: ruby 2.5.0dev (2017-04-18 trunk 58397) [x64-mingw32] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- Re the patch needed in MinGW builds for [TestEnumerable#test_callcc](https://github.com/ruby/ruby/blob/d6873af4bdc99… (file `test/ruby/test_enum.rb`), I ran the following code with `--disable-gems`: ```ruby require_relative '<path to ruby>/lib/ruby/2.5.0/x64-mingw32/continuation.so' 1000.times { c = nil o = Object.new class << o; self; end.class_eval do define_method(:<=>) do |x| callcc {|c2| c ||= c2 } 0 end end ary = [o,o] begin ary.sort_by {|x| x } c.to_s ; c.call rescue end } ``` Attached is a file with the code and the SEGV output when running. I removed the ruby path to shorten it. Note that if the line - ```ruby c.to_s ; c.call ``` is replaced with - ```ruby c.call ``` my system hangs/stops. No output, no response; have to force the command window closed... ---Files-------------------------------- TestEnumerable#call_cc_SEGV.txt (4.01 KB) -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111322] [Ruby master Feature#18285] NoMethodError#message uses a lot of CPU/is really expensive to call
by mame (Yusuke Endoh) 16 Dec '22

16 Dec '22
Issue #18285 has been updated by mame (Yusuke Endoh). I have created a PR based on @akr 's proposal. https://github.com/ruby/ruby/pull/6950 ``` 42.time #=> undefined method `time' for object Integer (NoMethodError) class Foo privatee #=> undefined local variable or method 'privatee' for class Foo (NoMethodError) end s = "" def s.foo = nil s.bar #=> undefined method `bar' for extended object String (NoMethodError) ``` I think we can almost agree to stop using `#inspect` in `NoMethodError#message`. Now, we need to decide the new message format. However, I think it is difficult to decide this through discussion and imagination because it is very much a matter of preference. So, how about trying @akr's proposal towards Ruby 3.3, after the release of Ruby 3.2? Let's evaluate how annoying (or not) the new error format would be for daily programming by those who uses master. Note that @akr is one of the most proven and trusted committers in the area of designing Ruby. I believe that his proposal is a good start. ---------------------------------------- Feature #18285: NoMethodError#message uses a lot of CPU/is really expensive to call https://bugs.ruby-lang.org/issues/18285#change-100699 * Author: ivoanjo (Ivo Anjo) * Status: Open * Priority: Normal ---------------------------------------- Hello there! I'm working at Datadog on the ddtrace gem -- https://github.com/DataDog/dd-trace-rb and we ran into this issue on one of our internal testing applications. I also blogged about this issue in <https://ivoanjo.me/blog/2021/11/01/nomethoderror-ruby-cost/>. ### Background While testing an application that threw a lot of `NoMethodError`s in a Rails controller (this was used for validation), we discovered that service performance was very much impacted when we were logging these exceptions. While investigating with a profiler, the performance impact was caused by calls to `NoMethodError#message`, because this Rails controller had a quite complex `#inspect` method, that was getting called every time we tried to get the `#message` from the exception. ### How to reproduce ```ruby require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'benchmark-ips' end puts RUBY_DESCRIPTION class GemInformation # ... def get_no_method_error method_does_not_exist rescue => e e end def get_runtime_error raise 'Another Error' rescue => e e end def inspect # <-- expensive method gets called when calling NoMethodError#message Gem::Specification._all.inspect end end NO_METHOD_ERROR_INSTANCE = GemInformation.new.get_no_method_error RUNTIME_ERROR_INSTANCE = GemInformation.new.get_runtime_error Benchmark.ips do |x| x.config(:time => 5, :warmup => 2) x.report("no method error message cost") { NO_METHOD_ERROR_INSTANCE.message } x.report("runtime error message cost") { RUNTIME_ERROR_INSTANCE.message } x.compare! end ``` ### Expectation and result Getting the `#message` from a `NoMethodError` should be no costly than getting it from any other exception. In reality: ``` ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux] no method error message cost 115.390 (± 1.7%) i/s - 580.000 in 5.027822s runtime error message cost 6.938M (± 0.5%) i/s - 35.334M in 5.092617s Comparison: runtime error message cost: 6938381.6 i/s no method error message cost: 115.4 i/s - 60130.02x (± 0.00) slower ``` ### Suggested solutions 1. Do not call `#inspect` on the object on which the method was not found (see <https://github.com/ruby/ruby/blob/e0915ba67964d843832148aeca29a1f8244ca7b1/…>) 2. Cache result of calling `#message` after the first call. Ideally this should be done together with suggestion 1. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111320] [Ruby master Bug#16836] configure-time LDFLAGS leak into ruby pkg-config file
by nobu (Nobuyoshi Nakada) 16 Dec '22

16 Dec '22
Issue #16836 has been updated by nobu (Nobuyoshi Nakada). Status changed from Assigned to Feedback IIRC, `rpath` is the path embedded in the linked binary, in order to resolve shared libraries at runtime. There is no reason to set the path that won’t exist at runtime, I think. ---------------------------------------- Bug #16836: configure-time LDFLAGS leak into ruby pkg-config file https://bugs.ruby-lang.org/issues/16836#change-100690 * Author: stapelberg (Michael Stapelberg) * Status: Feedback * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) * ruby -v: 2.7.1 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- When building ruby with e.g. `-Wl,-rpath=/ro/ruby-amd64-2.7.1-6/lib` (to make it hermetic, see my work-in-progress post at https://website-review.zekjur.net/pull/hermetic/posts/2020-05-04-distri-her…) I noticed that the resulting pkg-config file (`lib/pkgconfig/ruby-2.7.pc`) includes the LDFLAGS! This will result in software that links against ruby being built with the wrong `rpath`. In general, LDFLAGS should not be persisted into pkg-config. The attached patch fixes the issue. Thanks, ---Files-------------------------------- pc-ldflags.patch (563 Bytes) -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111279] [Ruby master Bug#19233] Failed to install sqlite3 gem since 7f1ca666424849134990d022266bcd4d6636465f using Docker
by yahonda (Yasuo Honda) 15 Dec '22

15 Dec '22
Issue #19233 has been reported by yahonda (Yasuo Honda). ---------------------------------------- Bug #19233: Failed to install sqlite3 gem since 7f1ca666424849134990d022266bcd4d6636465f using Docker https://bugs.ruby-lang.org/issues/19233 * Author: yahonda (Yasuo Honda) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0dev (2022-10-02T06:19:14Z :detached: 7f1ca66642) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Failed to install sqlite3 gem since 7f1ca666424849134990d022266bcd4d6636465f using Docker. This issue comes from https://github.com/rails/rails/pull/46711 . ## Steps to reproduce 1. Install Docker 2. Follow this step ``` git clone https://github.com/yahonda/rep19189 cd rep19189 docker build . ``` ## Expected behavior It should pass. ## Actual behavior It fails `Gem::Ext::BuildError: ERROR: Failed to build gem native extension.` ```ruby $ docker build . Sending build context to Docker daemon 69.63kB Step 1/5 : FROM rubylang/rubyfarm:7f1ca666424849134990d022266bcd4d6636465f ---> cdd68058177d Step 2/5 : RUN apt-get update -qq && apt-get install -y sqlite3 libsqlite3-dev pkg-config ---> Using cache ---> b8928c4f6425 Step 3/5 : WORKDIR /myapp ---> Using cache ---> bae259f8abf3 Step 4/5 : COPY Gemfile /myapp/Gemfile ---> Using cache ---> a9fe0822ad64 Step 5/5 : RUN bundle install ---> Running in 00cd9fc0e691 Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine. Fetching gem metadata from https://rubygems.org/..... Resolving dependencies... Using bundler 2.4.0.dev Fetching mini_portile2 2.8.0 Installing mini_portile2 2.8.0 Fetching sqlite3 1.5.4 Installing sqlite3 1.5.4 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ext/sqlite3 /opt/ruby/bin/ruby -I /opt/ruby/lib/ruby/3.2.0+2 extconf.rb Ignoring debug-1.6.2 because its extensions are not built. Try: gem pristine debug --version 1.6.2 Building sqlite3-ruby using packaged sqlite3. Extracting sqlite-autoconf-3400000.tar.gz into tmp/x86_64-linux-gnu/ports/sqlite3/3.40.0... OK Running 'configure' for sqlite3 3.40.0... OK Running 'compile' for sqlite3 3.40.0... OK Running 'install' for sqlite3 3.40.0... OK Activating sqlite3 3.40.0 (from /opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0)... Could not configure the build properly (pkg_config). Please install either the `pkg-config` utility or the `pkg-config` rubygem. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/opt/ruby/bin/$(RUBY_BASE_NAME) --help --download-dependencies --with-sqlcipher --without-sqlcipher --with-sqlcipher-dir --without-sqlcipher-dir --with-sqlcipher-include --without-sqlcipher-include --with-sqlcipher-lib --without-sqlcipher-lib --enable-system-libraries --disable-system-libraries --with-sqlcipher --without-sqlcipher --with-sqlcipher-dir --without-sqlcipher-dir --with-sqlcipher-include --without-sqlcipher-include --with-sqlcipher-lib --without-sqlcipher-lib --with-sqlite-source-dir --with-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-dir --without-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-dir --with-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-include --without-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-include=${/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-dir}/include --with-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-lib --without-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-lib=${/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-dir}/lib --with-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-config --without-/opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4/ports/x86_64-linux-gnu/sqlite3/3.40.0/lib/pkgconfig/sqlite3.pc-config --with-pkg-config --without-pkg-config To see why this extension failed to compile, please check the mkmf.log which can be found here: /opt/ruby/lib/ruby/gems/3.2.0+2/extensions/x86_64-linux/3.2.0+2/sqlite3-1.5.4/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /opt/ruby/lib/ruby/gems/3.2.0+2/gems/sqlite3-1.5.4 for inspection. Results logged to /opt/ruby/lib/ruby/gems/3.2.0+2/extensions/x86_64-linux/3.2.0+2/sqlite3-1.5.4/gem_make.out /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:102:in `run' /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/ext_conf_builder.rb:28:in `build' /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:171:in `build_extension' /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:205:in `block in build_extensions' /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:202:in `each' /opt/ruby/lib/ruby/3.2.0+2/rubygems/ext/builder.rb:202:in `build_extensions' /opt/ruby/lib/ruby/3.2.0+2/rubygems/installer.rb:843:in `build_extensions' /opt/ruby/lib/ruby/3.2.0+2/bundler/rubygems_gem_installer.rb:72:in `build_extensions' /opt/ruby/lib/ruby/3.2.0+2/bundler/rubygems_gem_installer.rb:28:in `install' /opt/ruby/lib/ruby/3.2.0+2/bundler/source/rubygems.rb:202:in `install' /opt/ruby/lib/ruby/3.2.0+2/bundler/installer/gem_installer.rb:54:in `install' /opt/ruby/lib/ruby/3.2.0+2/bundler/installer/gem_installer.rb:16:in `install_from_spec' /opt/ruby/lib/ruby/3.2.0+2/bundler/installer/parallel_installer.rb:186:in `do_install' /opt/ruby/lib/ruby/3.2.0+2/bundler/installer/parallel_installer.rb:177:in `block in worker_pool' /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:62:in `apply_func' /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:57:in `block in process_queue' /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:54:in `loop' /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:54:in `process_queue' /opt/ruby/lib/ruby/3.2.0+2/bundler/worker.rb:91:in `block (2 levels) in create_threads' An error occurred while installing sqlite3 (1.5.4), and Bundler cannot continue. In Gemfile: sqlite3 The command '/bin/sh -c bundle install' returned a non-zero code: 5 ``` -- https://bugs.ruby-lang.org/
4 8
0 0
  • ← Newer
  • 1
  • ...
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • ...
  • 25
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.