Web lists-archives.com

Re: [ANNOUNCEMENT] Updated: libreadline7-7.0.1-1, libreadline-devel-7.0.1-1, bash-4.4.5-1




On 01/19/2017 07:23 AM, Eliot Moss wrote:
>> I have root caused this. With the new readline, running ./configure
> creates
>> config.h, as expected. However new version adds this line:
>>
>> #define HAVE_PSELECT 1
>>
>> If you remove this from config.h, then make, the resultant DLL behaves
> as it did
>> with previous readline. Not sure what is causing this change, I will
> try to dig
>> into it more.
> 
> You probably found it, but here's why they added use of pselect:
> 
> "h.  Use pselect(2), if available, to wait for input before calling
> read(2), so
>     a SIGWINCH can interrupt it, since it doesn't interrupt read(2)."
> 
> Of course that does not explain why it's not working how we would like ...

Here's my guess - cygwin1.dll has an incomplete implementation of
pselect on Windows consoles when it comes to capturing ALT-numkeypad
sequences.  Probably something to do with the fact that it takes
multiple keystrokes before a single character is supposed to be
recognized, which means you have to make a decision after each key state
change event whether a character is complete or not.  Under the old
code, when pselect was not in use, readline just used read() until a
character showed up (but blocked in doing so, and risked SIGWINCH
issues); now readline can use pselect() and sees that a key has been
pressed, except that there is no input available until several more keys
are pressed and a key released.

I'm no expert in the windows console handling code in cygwin1.dll, but
if you are correct that the use (or absence) of HAVE_PSELECT in modern
readline makes a difference, then it sounds like we have two things to
do: first, I will rebuild readline with a patch to avoid pselect() (the
behavior of readline will be riskier, and may break under SIGWINCH, but
at least that is no worse than it was with the old readline), meanwhile,
someone with more expertise in the console handling code will need a
boiled-down testcase (probably a simple .c program that compares a
straight read() with a pselect() loop that decides when to read()) to
see if they can fix the handling of ALT-numkeypad entries under the
console in cygwin1.dll.  Once a fixed cygwin1.dll is available, then I
can re-release a version of readline built with HAVE_PSELECT.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature