[Openmcl-devel] Raw-mode terminal weirdness redux
Ron Garret
ron at flownet.com
Tue Mar 27 11:11:51 PDT 2018
OMG, that’s the answer! Thank you!
Contact me off list if you want to collect the bug bounty.
On Mar 27, 2018, at 10:05 AM, David Brown <lisp at davidb.org> wrote:
> On Tue, Mar 27, 2018 at 09:32:54AM -0700, Ron Garret wrote:
>> Found a reliable workaround!
>>
>> ...
>> This version is broken. If you comment out the line that says “This
>> breaks it” it will start working properly. Both working and
>> non-working versions are 100% reliable. Using a single RLET to
>> allocate both termios structures also works. It’s only when there is
>> a call to tcgetattr in between the allocations that it breaks. (Note
>> that the “broken” version works in 1.8. But for the fact that C code
>> can reproduce this problem intermittently I would call this slam-dunk
>> evidence that this is a bug in the CCL compiler, most likely in RLET.
>> But since the C code does what it does, I’m not willing to go quite
>> that far.)
>
> The common thread in all of these, is that "raw" is only partially
> initialized (cfmakeraw only initializes c_iflag). Subtle changes in
> stack positioning will make the initial values different, which
> explains both the inconsistent behavior with the C program, and the
> behavior of the lisp programs (and why it matters how you declare it).
>
> You need to either tcgetattr again to fill in the 'raw' with the
> current values, or copy the data from the 'normal' before calling
> cfmakeraw on it.
>
> My guess is that, with c_oflag being set to an uninitialized value, it
> has flags set such that it generates no output.
>
> David
More information about the Openmcl-devel
mailing list