﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1254	with-stty segfaults when current-input-port is not a terminal	Christian Kellermann	Alex Shinn	"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."	defect	closed	major	someday	unknown	4.10.x	fixed	stty segfault terminal port		
