Perl 6 ignores SIGPIPE

--001a114660e276a13605520dfacb
Content-Type: text/plain; charset="UTF-8"

I see at

http://www.moarvm.com/releases.html

....that as of the 2017.03 release, Perl 6 "ignores SIGPIPE by default."  I
discovered this for myself when I piped a program that generates unlimited
output to the head utility, and the program did not exit when head was
finished.  Simple example:

$ perl6 -e '.say for ^Inf' | head

This will print numbers up to 9, and then continue to use almost 100% of
the CPU printing to a closed pipe.

I haven't been able to turn up any discussion about this change.  Does
anyone have any insight?  It's surprising and, frankly, unwelcome.

--001a114660e276a13605520dfacb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div><div>I see at<br><br><a href=3D"http://www.=
moarvm.com/releases.html">http://www.moarvm.com/releases.html</a><br><br></=
div>...that as of the 2017.03 release, Perl 6 &quot;ignores SIGPIPE by defa=
ult.&quot;=C2=A0 I discovered this for myself when I piped a program that g=
enerates unlimited output to the head utility, and the program did not exit=
 when head was finished.=C2=A0 Simple example:<br><br></div>$ perl6 -e &#39=
;.say for ^Inf&#39; | head<br><br></div>This will print numbers up to 9, an=
d then continue to use almost 100% of the CPU printing to a closed pipe.<br=
><br></div>I haven&#39;t been able to turn up any discussion about this cha=
nge.=C2=A0 Does anyone have any insight?=C2=A0 It&#39;s surprising and, fra=
nkly, unwelcome.<br><br></div>

--001a114660e276a13605520dfacb--
0
eefacm
6/16/2017 6:34:33 AM
perl.perl6.users 786 articles. 0 followers. Follow

4 Replies
22 Views

Similar Articles

[PageSpeed] 20

> On 16 Jun 2017, at 08:34, Sean McAfee <eefacm@gmail.com> wrote:
>=20
> I see at
>=20
> http://www.moarvm.com/releases.html
>=20
> ...that as of the 2017.03 release, Perl 6 "ignores SIGPIPE by =
default."  I discovered this for myself when I piped a program that =
generates unlimited output to the head utility, and the program did not =
exit when head was finished.  Simple example:
>=20
> $ perl6 -e '.say for ^Inf' | head
>=20
> This will print numbers up to 9, and then continue to use almost 100% =
of the CPU printing to a closed pipe.
>=20
> I haven't been able to turn up any discussion about this change.  Does =
anyone have any insight?  It's surprising and, frankly, unwelcome.

Trying this on HEAD I get:

$ 6 '.say for ^Inf' | head
0
1
2
3
4
5
6
7
8
9
Failed to write bytes to filehandle: Broken pipe
  in block <unit> at -e line 1

So it would appear this got fixed by the synchronous IO refactor, and =
will be available in the 2017.06 release, which is scheduled for =
tomorrow.



Liz=
0
liz
6/16/2017 10:13:57 AM
--94eb2c0580a8a5da80055212aae6
Content-Type: text/plain; charset="UTF-8"

On Fri, Jun 16, 2017 at 12:13 PM, Elizabeth Mattijsen <liz@dijkmat.nl>
wrote:
>
>
> Failed to write bytes to filehandle: Broken pipe
>   in block <unit> at -e line 1
>
> So it would appear this got fixed by the synchronous IO refactor, and will
> be available in the 2017.06 release, which is scheduled for tomorrow.
>
>
>
This appears to be only a partial fix with an unexpected outcome.

awk, Perl 5, Ruby, etc. do not generate errors for similar use of pipes,
and instead use exit status 0.
-- 
Jan

--94eb2c0580a8a5da80055212aae6
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On F=
ri, Jun 16, 2017 at 12:13 PM, Elizabeth Mattijsen <span dir=3D"ltr">&lt;<a =
href=3D"mailto:liz@dijkmat.nl" target=3D"_blank">liz@dijkmat.nl</a>&gt;</sp=
an> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><br>
Failed to write bytes to filehandle: Broken pipe<br>
=C2=A0 in block &lt;unit&gt; at -e line 1<br>
<br>
So it would appear this got fixed by the synchronous IO refactor, and will =
be available in the 2017.06 release, which is scheduled for tomorrow.<br>
<br><br></blockquote></div><div><br></div><div>This appears to be only a pa=
rtial fix with an unexpected outcome.</div><div><br></div><div>awk, Perl 5,=
 Ruby, etc. do not generate errors for similar use of pipes, and instead us=
e exit status 0.</div>-- <br><div class=3D"gmail_signature" data-smartmail=
=3D"gmail_signature">Jan</div>
</div></div>

--94eb2c0580a8a5da80055212aae6--
0
frettled
6/16/2017 12:10:09 PM
> On 16 Jun 2017, at 14:10, Jan Ingvoldstad <frettled@gmail.com> wrote:
>=20
> On Fri, Jun 16, 2017 at 12:13 PM, Elizabeth Mattijsen <liz@dijkmat.nl> =
wrote:
>=20
> Failed to write bytes to filehandle: Broken pipe
>   in block <unit> at -e line 1
>=20
> So it would appear this got fixed by the synchronous IO refactor, and =
will be available in the 2017.06 release, which is scheduled for =
tomorrow.
>=20
>=20
>=20
> This appears to be only a partial fix with an unexpected outcome.
>=20
> awk, Perl 5, Ruby, etc. do not generate errors for similar use of =
pipes, and instead use exit status 0.

Then this should be filed as a rakudobug  :-)



Liz
0
liz
6/16/2017 12:17:01 PM
I think it'd be cool to notice, and properly report, write errors, rather t=
han silently ignoring them=2E

Back when lwall was asking for things we wanted perl6 to do, I asked to be=
 able to wrap builtins specifically so I could

use Fatal qw(print)=2E

Yes, perl5 often ignores write errors, but no, I don't count that a virtue=
=2E 
0
bennett
6/16/2017 12:54:50 PM
Reply: