summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2017-04-23 22:39:02 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2017-04-23 22:39:21 +0100
commit3cf9beab238c015964bb1c8193d9a4394fce3a21 (patch)
tree5f6b1dce85756729b21abec4f2874cef40bde989 /dev-lang/crystal
parentdev-perl/File-Next: 1.160.0 ALLARCHES stable re bug #615692 (diff)
downloadgentoo-3cf9beab238c015964bb1c8193d9a4394fce3a21.tar.gz
gentoo-3cf9beab238c015964bb1c8193d9a4394fce3a21.tar.bz2
gentoo-3cf9beab238c015964bb1c8193d9a4394fce3a21.zip
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
Diffstat (limited to 'dev-lang/crystal')
-rw-r--r--dev-lang/crystal/crystal-0.22.0.ebuild8
-rw-r--r--dev-lang/crystal/files/crystal-0.22.0-blocking-stdio-hack.patch20
-rw-r--r--dev-lang/crystal/metadata.xml3
3 files changed, 30 insertions, 1 deletions
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