#710953 ecl: segfault when both stdout and stderr are full

Package:
ecl
Source:
ecl
Description:
Embeddable Common-Lisp: has an interpreter and can compile to C
Submitter:
Julien Puydt
Date:
2021-07-31 19:39:03 UTC
Severity:
normal
#710953#5
Date:
2013-06-03 18:46:53 UTC
From:
To:
The following triggers a segfault:
$ echo "syntax error" | ecl 2>/dev/full

this crash is supposed to be fixed by the patch write_error.patch from
the sage package which I forwarded some days ago in a personal mail.

Hélas, I tried to roll my own ecl-12.12.1-2.1 with that patch added, and
still get crashes, and I'm at loss trying to find out why.

Notice that the same test of syntax error piped in an executable whose
stderr is redirected to /dev/full, works with sage's patched ecl, with
sage's gap, sage's gp, sage's ipython and sage's singular, so it's
really something that it routinely working for other projects.

Let's see if you have better ideas :-/

Snark on #debian-science

#710953#10
Date:
2021-07-31 19:29:24 UTC
From:
To:
Hi,

the originally reported problem is already fixed, i.e. only redirecting stderr to /dev/full no longer causes a crash:
$ echo "syntax error" | ecl 2>/dev/full
ECL (Embeddable Common-Lisp) 20.4.24 (git:UNKNOWN)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2013 Juan J. Garcia-Ripoll
Copyright (C) 2018 Daniel Kochmanski
Copyright (C) 2020 Daniel Kochmanski and Marius Gerbershagen
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help. 
Top level in: #<process TOP-LEVEL 0x7f24c8bb5f80>.
Available restarts:

1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at SI:BYTECODES. [Evaluation of: SYNTAX] In: #<process TOP-LEVEL 0x7f24c8bb5f80>.
$ echo $?
0

However, the sagemath testsuite still triggers a related crash in ecl:
sage -t --long --random-seed=0 src/sage/interfaces/tests.py
**********************************************************************
File "src/sage/interfaces/tests.py", line 34, in sage.interfaces.tests
Failed example:
    subprocess.call("echo syntax error | ecl", **kwds) in (0, 255)
Expected:
    True
Got:
    False
**********************************************************************

This crash is easy to reproduce:
$ ecl &> /dev/full
Segmentation fault (core dumped)

Occasionally, similar crashes also occur in other sagemath tests, e.g. src/sage/interfaces/lisp.py.
This can be reproduced as follows:
$ sage
sage: l = Lisp()
sage: l._start()
sage: l.quit()

The problem is that ecl crashes when it cannot write to both stdout and stderr.
Therefore I'm reusing this bug for that related problem.

There is already an open upstream issue about this (see the forwarded URL).

Regards,
Ahzo