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
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="
"${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) \
--- /dev/null
+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
<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