public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sergei Trofimovich" <slyfox@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/crystal/files/, dev-lang/crystal/
Date: Sun, 23 Apr 2017 21:39:49 +0000 (UTC)	[thread overview]
Message-ID: <1492983561.3cf9beab238c015964bb1c8193d9a4394fce3a21.slyfox@gentoo> (raw)

commit:     3cf9beab238c015964bb1c8193d9a4394fce3a21
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 23 21:39:02 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Apr 23 21:39:21 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3cf9beab

dev-lang/crystal: Workaround tty corruption in crystal, bug #616256

Patch restores blocking mode of file desriptors in exchange
of potential runtime deadlocks when dealing with stdio.

As it's a potentially invasive patch it's not enabled by default
and is available only under USE=blocking-stdio-hack

Reported-by: Renich Bon Ciric
Bug: https://github.com/crystal-lang/crystal/issues/2065
Bug: https://bugs.gentoo.org/616256
Package-Manager: Portage-2.3.5, Repoman-2.3.2

 dev-lang/crystal/crystal-0.22.0.ebuild               |  8 +++++++-
 .../files/crystal-0.22.0-blocking-stdio-hack.patch   | 20 ++++++++++++++++++++
 dev-lang/crystal/metadata.xml                        |  3 +++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/dev-lang/crystal/crystal-0.22.0.ebuild b/dev-lang/crystal/crystal-0.22.0.ebuild
index 91cd89b0f5a..219789c6b1c 100644
--- a/dev-lang/crystal/crystal-0.22.0.ebuild
+++ b/dev-lang/crystal/crystal-0.22.0.ebuild
@@ -18,7 +18,7 @@ SRC_URI="https://github.com/crystal-lang/crystal/archive/${PV}.tar.gz -> ${P}.ta
 LICENSE="Apache-2.0"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="doc debug examples +xml +yaml"
+IUSE="doc debug examples blocking-stdio-hack +xml +yaml"
 
 # dev-libs/boehm-gc[static-libs] dependency problem,  check the issue: https://github.com/manastech/crystal/issues/1382
 DEPEND="
@@ -41,6 +41,12 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-0.20.5-LDFLAGS.patch
 )
 
+src_prepare() {
+	default
+
+	use blocking-stdio-hack && eapply "${FILESDIR}"/"${PN}"-0.22.0-blocking-stdio-hack.patch
+}
+
 src_compile() {
 	emake \
 		$(usex debug "" release=1) \

diff --git a/dev-lang/crystal/files/crystal-0.22.0-blocking-stdio-hack.patch b/dev-lang/crystal/files/crystal-0.22.0-blocking-stdio-hack.patch
new file mode 100644
index 00000000000..07b7dba7be6
--- /dev/null
+++ b/dev-lang/crystal/files/crystal-0.22.0-blocking-stdio-hack.patch
@@ -0,0 +1,20 @@
+Workaround tty corruption in crystal.
+
+Patch restores blocking mode of file desriptors
+in exchange of potential runtime deadlocks
+when dealing with stdio.
+
+Reported-by: Renich Bon Ciric
+Bug: https://github.com/crystal-lang/crystal/issues/2065
+Bug: https://bugs.gentoo.org/616256
+diff --git a/src/compiler/crystal/stdio.cr b/src/compiler/crystal/stdio.cr
+new file mode 100644
+index 000000000..e65f65089
+--- /dev/null
++++ b/src/compiler/crystal/stdio.cr
+@@ -0,0 +1,5 @@
++module Crystal
++  STDIN.blocking = true
++  STDOUT.blocking=true
++  STDERR.blocking = true
++end

diff --git a/dev-lang/crystal/metadata.xml b/dev-lang/crystal/metadata.xml
index 80b55be2293..8c0dacece65 100644
--- a/dev-lang/crystal/metadata.xml
+++ b/dev-lang/crystal/metadata.xml
@@ -22,6 +22,9 @@
 		<flag name="debug">
 			Build each module as a separate object file. Speeds build up.
 		</flag>
+		<flag name="blocking-stdio-hack">
+			Keep STDIO file descriptors in blocking mode.
+		</flag>
 		<flag name="yaml">
 			Use the <pkg>dev-libs/libyaml</pkg> library to enable Crystal yaml
 			module


             reply	other threads:[~2017-04-23 21:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23 21:39 Sergei Trofimovich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-06-30  7:08 [gentoo-commits] repo/gentoo:master commit in: dev-lang/crystal/files/, dev-lang/crystal/ Sergei Trofimovich
2017-09-16 10:54 Sergei Trofimovich
2017-11-25 19:58 Sergei Trofimovich
2017-12-11 20:03 Michał Górny
2017-12-21 10:13 Sergei Trofimovich
2018-08-09 22:34 Sergei Trofimovich
2018-09-02 10:53 Sergei Trofimovich
2018-12-23 13:26 Sergei Trofimovich
2018-12-23 14:23 Sergei Trofimovich
2019-01-31  7:21 Sergei Trofimovich
2020-04-07 21:47 Sergei Trofimovich
2021-07-15  9:28 Sergei Trofimovich
2022-04-24 14:41 Michał Górny
2022-09-09  9:24 Sam James
2023-02-12  0:48 Maciej Barć
2025-01-30 17:44 Maciej Barć

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492983561.3cf9beab238c015964bb1c8193d9a4394fce3a21.slyfox@gentoo \
    --to=slyfox@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox