chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1254: with-stty segfaults when current-input-port is


From: Chicken Trac
Subject: [Chicken-janitors] #1254: with-stty segfaults when current-input-port is not a terminal
Date: Tue, 12 Jan 2016 12:23:49 -0000

#1254: with-stty segfaults when current-input-port is not a terminal
-----------------------------------------+---------------------
 Reporter:  ckeen                        |      Owner:  ashinn
     Type:  defect                       |     Status:  new
 Priority:  major                        |  Milestone:  someday
Component:  unknown                      |    Version:  4.10.x
 Keywords:  stty segfault terminal port  |
-----------------------------------------+---------------------
 stty segfaults when the current-input-port is not a terminal.

 Example:

 {{{
 (use stty)

 (with-stty (not 'echo)
            (print (read-line)))

 }}}

 This results in:

 {{{

 echo foo |./t
 foo

 Error: segmentation violation

         Call history:

         t.scm:4: print
         t.scm:3: stty#with-stty
         stty.scm:440: get-terminal-attributes
         stty.scm:195: make-term-attrs
         stty.scm:196: port?
         stty.scm:196: port->fileno
         stty.scm:200: free-term-attrs
         stty.scm:441: dynamic-wind
         stty.scm:443: stty
         stty.scm:373: port?
         stty.scm:376: get-terminal-attributes
         stty.scm:195: make-term-attrs
         stty.scm:196: port?
         stty.scm:196: port->fileno
         stty.scm:200: free-term-attrs
         stty.scm:377: term-attrs-iflag          <--
 }}}

 A patch is attached, where stty does nothing if get-terminal-attributes
 fails at the beginning and with-stty does only execute its thunk.

 Maybe raising an explicit error is a better way to handle this than
 silently ignoring the issue.

--
Ticket URL: <http://bugs.call-cc.org/ticket/1254>
CHICKEN Scheme <http://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]