[Bug 268076] dc(1): crash on window size change

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 30 Nov 2022 15:03:46 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268076

Gavin D. Howard <gavin.d.howard@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gavin.d.howard@gmail.com

--- Comment #3 from Gavin D. Howard <gavin.d.howard@gmail.com> ---
Author of the bc/dc here.

I have reproduced this behavior. A couple notes first.

I don't think bc's error handling "obscures" things. When it outputs the error
it did, that's because there *was* an I/O error, but one on either `stdin`,
`stdout`, or `stderr`. Handling terminal stuff requires a lot of I/O, and if
any of it fails, especially since it would have happened on one of the standard
streams that should nearly always work, bc/dc has to assume that something has
gone terribly wrong, so it quits with a complaint.

But the error handling is actually the same between the calculators, so dc
should not have acted differently from bc if history were activated.

That was the problem: in dc, history is *not* activated by default. The bug is
that el_resize() was called anyway, despite not being initialized.

I have pushed a commit (https://git.yzena.com/gavin/bc/commit/19f8e4f325f538)
that fixes the crash. That seems to have fixed the problem.

Can you pull my changes and test that it works for you? You will need to build
like so:

```
./configure -e -gO0
make
```

And the built programs will be `bin/bc` and `bin/dc`.

By the way, if you want to activate history in dc, you need to set the
`DC_TTY_MODE` environment variable to a non-zero integer value. The reason it
is not activated by default is because that's the behavior of the old dc.

-- 
You are receiving this mail because:
You are the assignee for the bug.