Article View: net.bugs
Article #550Steve Lademann's terminfo bug
From: jimc
Date: Tue, 20 May 1986 18:20
Date: Tue, 20 May 1986 18:20
50 lines
2752 bytes
2752 bytes
Earlier on, an Steve Lademann reported to net.bugs an error in Bell
System V software. In recapitulation, this observant programmer
noticed that when a key is pressed and the available keypad keys are
searched, the loop terminates improperly in that search if the key is
not known. Here is an excerpt from his report:
> This is due to a bad condition on a 'for' loop at line 111 (or
> thereabouts). The condition reads.
>
> for(i=0; SP->kp[i].keynum >= 0; i++)
>
> which causes it to whiz off through memory looking for a key which is
> numbered negatively, whereas the code marks the entry after the last
> key in the array as 0.
>
> The (obvious) cure is therefore
>
> for(i=0; SP->kp[i].keynum > 0; i++)
>
>
> -----------------------------------------------------------------
> |Steve Lademann |Phone: 44 727 59292 x326 |
> |Marconi Instruments Ltd|UUCP : ...mcvax!ukc!hrc63!miduet!steve |
> |St. Albans |NRS : steve@uk.co.gec-mi-ate.mifnet |
> |Herts. UK | |
> -----------------------------------------------------------------
> |"The views expressed herein do not necessarily reflect"| |
> |"those of my employer, and may not even reflect my own"| |
> -----------------------------------------------------------------
>
I did some investigating, and it does seem correct that the wgetch()
routine does not have a proper termination condition, as reported,
but I found it impossible to get that to produce a problem when all the
keys on the terminal are known to the curses software, that is, when
_init_keypad() is defined to encompass all the keys on a particular
keyboard. Under those circumstances, every search is successful and
the end of the list is never reached. Steve, did you use an
_init_keypad() that does not cover all the keys you have available on
your keyboard, and if so, did the core dump occur only when you pressed
one of those unknown keys? Does anyone else in net-land have some
experience with this?
______________________________
Jim Campbell
{decvax ! cca | yale | ihnp4 | cbosgd}!ima!jimc
{bbncca | harvard | zurton | cfib | mit-ems | wjh12 }!ima!jimc
{uscvax | ucla-vax | vortex}!ism780!jimc
INTERACTIVE Systems, 7th floor, 441 Stuart St, Boston, MA 02116; 617-247-1155
Technical Details
Message-ID:
<84000001@haddock>Path:
arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!harvard!think!ima!haddock!jimcShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!harvard!think!ima!haddock!jimc From: jimc@haddock Newsgroups: net.bugs Subject: Steve Lademann's terminfo bug Message-ID: <84000001@haddock> Date: Tue, 20-May-86 14:20:00 EDT Article-I.D.: haddock.84000001 Posted: Tue May 20 14:20:00 1986 Date-Received: Sat, 24-May-86 01:44:09 EDT Lines: 50 Nf-ID: #N:haddock:84000001:000:2226 Nf-From: haddock!jimc May 20 14:20:00 1986