bugOCaml Text Mode Kit - Bugs: bug #31517, implementation of...

 
 

bug #31517: implementation of Curses.window_handler_on looks unsafe

Submitter:  Paul Pelzl <pelzlpj>
Submitted:  Tue 02 Nov 2010 01:06:56 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 02 Nov 2010 01:06:56 AM UTC, original submission:  

Curses.window_handler_on registers the following signal handler for SIGWINCH:

    static void winch_handler(int n)
    {
        signal(n,winch_handler);
        ungetch(KEY_RESIZE);
    }

This seems very unlikely to invoke undefined behavior, as ungetch() is most likely not a "safe function" in the POSIX signal sense (see "man 7 signal").  In practice, this handler doesn't appear to work right: a resize event received during a blocking call to getch() will NOT cause getch() to immediately unblock as one might expect.

Most ncurses builds have a default SIGWINCH handler which does the right thing.  But it would be nice to have a non-broken implementation of Curses.window_handler_on for the sake of better portability.

Paul Pelzl <pelzlpj>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pelzlpj (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code