[arch-commits] Commit in crystal/trunk (PKGBUILD libevent-2.1.11.patch)
Evangelos Foutras
foutrelis at archlinux.org
Mon Aug 12 15:39:11 UTC 2019
Date: Monday, August 12, 2019 @ 15:39:11
Author: foutrelis
Revision: 499025
upgpkg: crystal 0.30.0-4
Unbreak after libevent 2.1.11 rebuild (FS#63438).
Added:
crystal/trunk/libevent-2.1.11.patch
Modified:
crystal/trunk/PKGBUILD
-----------------------+
PKGBUILD | 11 ++++++--
libevent-2.1.11.patch | 61 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 3 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2019-08-12 13:19:15 UTC (rev 499024)
+++ PKGBUILD 2019-08-12 15:39:11 UTC (rev 499025)
@@ -3,7 +3,7 @@
pkgname=crystal
pkgver=0.30.0
-pkgrel=3
+pkgrel=4
pkgdesc='The Crystal Programming Language'
arch=(x86_64)
url='https://crystal-lang.org'
@@ -15,12 +15,17 @@
'libyaml: For YAML support'
'gmp: For BigInt support'
'libxml2: For XML support')
-source=(crystal-$pkgver.tar.gz::https://github.com/crystal-lang/crystal/archive/$pkgver.tar.gz)
-sha256sums=('fc884970089e382344540676a9c5aa4f369c9a0f45d1858e079b4ce26878164a')
+source=(crystal-$pkgver.tar.gz::https://github.com/crystal-lang/crystal/archive/$pkgver.tar.gz
+ libevent-2.1.11.patch)
+sha256sums=('fc884970089e382344540676a9c5aa4f369c9a0f45d1858e079b4ce26878164a'
+ '3917a15399078079b6b8d78f418f4dbc8dcfd94b8a39f7b083d6075b441a5adc')
prepare() {
cd $pkgname-$pkgver
sed -i 's|Please install shards: https://github.com/ysbaddaden/shards|Please install shards: pacman -S shards|' src/compiler/crystal/command.cr
+
+ # https://github.com/crystal-lang/crystal/issues/8044
+ patch -Np1 -i ../libevent-2.1.11.patch
}
build() {
Added: libevent-2.1.11.patch
===================================================================
--- libevent-2.1.11.patch (rev 0)
+++ libevent-2.1.11.patch 2019-08-12 15:39:11 UTC (rev 499025)
@@ -0,0 +1,61 @@
+From 284fb1e35abce2ecbebe41b3d6a78bf757145b9b Mon Sep 17 00:00:00 2001
+From: Juan Wajnerman <jwajnerman at manas.com.ar>
+Date: Thu, 8 Aug 2019 08:23:26 -0300
+Subject: [PATCH] Don't resume fibers directly from event loop callbacks (fixes
+ #8044). (#8058)
+
+This is required to enable compatibility with libevent 2.1.11, because
+a warning is now raised if a `fork` is executed from within the event loop (https://github.com/libevent/libevent/commit/497ef904d544ac51de43934549dbeccce8e6e8f8).
+Since most Crystal code actually runs from within the event loop (from libevent point of view)
+the solution is enqueue the fibers and resume them outside the call to `event_base_loop`.
+---
+ src/crystal/event_loop.cr | 9 +++++++--
+ src/io/evented.cr | 4 ++--
+ 2 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/src/crystal/event_loop.cr b/src/crystal/event_loop.cr
+index 9d8cc2812a..a4726b16d4 100644
+--- a/src/crystal/event_loop.cr
++++ b/src/crystal/event_loop.cr
+@@ -13,12 +13,17 @@ module Crystal::EventLoop
+ end
+
+ private def self.loop_fiber
+- @@loop_fiber ||= Fiber.new { @@eb.run_loop }
++ @@loop_fiber ||= Fiber.new do
++ loop do
++ @@eb.run_once
++ Crystal::Scheduler.reschedule
++ end
++ end
+ end
+
+ def self.create_resume_event(fiber)
+ @@eb.new_event(-1, LibEvent2::EventFlags::None, fiber) do |s, flags, data|
+- data.as(Fiber).resume
++ Crystal::Scheduler.enqueue data.as(Fiber)
+ end
+ end
+
+diff --git a/src/io/evented.cr b/src/io/evented.cr
+index ae2895c571..deca61cd87 100644
+--- a/src/io/evented.cr
++++ b/src/io/evented.cr
+@@ -99,7 +99,7 @@ module IO::Evented
+ @read_timed_out = timed_out
+
+ if reader = @readers.try &.shift?
+- reader.resume
++ Crystal::Scheduler.enqueue reader
+ end
+ end
+
+@@ -108,7 +108,7 @@ module IO::Evented
+ @write_timed_out = timed_out
+
+ if writer = @writers.try &.shift?
+- writer.resume
++ Crystal::Scheduler.enqueue writer
+ end
+ end
+
More information about the arch-commits
mailing list