From Newsgroup: comp.lang.misc
On 16/09/2025 15:39, Janis Papanagnou wrote:
Picking just an initial sequence of the created output lines issues an
error diagnostic:
$ genie -x 'FOR i TO 2000 DO print ((i, newline)) OD' | head -2
+1
+2
a68g: exiting: action failed (a68g-bits.c: 196, sigpipe_handler)
And defining event handler (say, 'on transput error' or 'on file end')
in the Genie Algol 68 source doesn't catch that diagnostic, it seems?
Indeed; there is no error in the A68G.
Usually I'm annoyed by such diagnostics in application cases like the
pipe constructs on OS/shell level.
I think the root problem is that there are too many ways a pipe
can fail, some of which are expected and some not, so that "SIGPIPE" is
being expected to guess whether there has been an error. I agree with
Richard [nearby article] that the Unix/Linux default is to fail silently,
and that this is commonly [but not always] the appropriate behaviour.
But Marcel seems always to have taken the view that errors should be
reported. In cases like the present, it's difficult to know whether
there has been an error or not, so A68G reports the "SIGPIPE" anyway.
I have an impression that it's "head" or Linux that is inconsistent;
note that for small values of 2000 ["FOR i to 20 ..."] or large values
of -2 ["head -1998"] there is no "SIGPIPE". Also, there is no problem
reported with "tail" ["... | tail | head -2" or even "tail 3000", or
even "... | head -2 | tail"]. I assume there are differences in what
is buffered, leading to differences in whether "SIGPIPE" is raised?
[...]
Should there be a diagnostic message or not, should such diagnostic
be interceptable by an event handler or not?
Pass. But it would be nice if it was consistent!
What's the rationale for Awk not printing a diagnostic message, but Genie/Algol 68 does?
Aho et al believe in silent errors, Marcel believes you should
be told?
--
Andy Walker, Nottingham.
Andy's music pages: www.cuboid.me.uk/andy/Music
Composer of the day: www.cuboid.me.uk/andy/Music/Composers/Mozart,L
--- Synchronet 3.21a-Linux NewsLink 1.2