﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
985	read-line blocks intermittantly on Atom based netbook	Matt Welland	Matt Welland	"This problem first shows up in:

9eef92115fba6034a98cc21ef740fd82ea52387b is the first bad commit
commit 9eef92115fba6034a98cc21ef740fd82ea52387b
Author: Peter Bex <peter.bex@xs4all.nl>
Date:   Sun Nov 18 21:03:51 2012 +0100

    Fix select() buffer overrun vulnerability by using POSIX poll() on systems that support it, leaving only those few systems vulnerable that don't (ie, only Windows).
    
I used the following code snippet to test. It took as much as 10 runs to trigger the bug sometimes:

=============CODE=============
(use posix)

(define (conservative-read port)
  (let loop ((res '()))
    (if (not (eof-object? (peek-char port)))
        (loop (cons (read-char port) res))
        (apply conc (reverse res)))))

(define (cmd-run-with-stderr->list cmd . params)
   (let-values (((fh fho pid fhe) (if (null? params)
                                      (process* cmd)
                                      (process* cmd params))))
       (let loop ((curr (read-line fh))
                  (result  '()))
         (print ""GOT HERE 1, curr="" curr)
         (let ((errstr (conservative-read fhe)))
           (print ""GOT HERE 3, errstr="" errstr)
           (if (not (string=? errstr """"))
               (set! result (cons errstr result))))
         (print ""GOT HERE 2, result="" result)
         (if (not (eof-object? curr))
             (begin
               (print ""GOT HERE 4"")
               (loop (read-line fh)
                     (cons curr result)))
             (begin
               (print ""GOT HERE 5"")
               (close-input-port fh)
               (close-input-port fhe)
               (close-output-port fho)
               (reverse result))))))

(print ""Got: "" (cmd-run-with-stderr->list ""ls""))

"	defect	assigned	minor	someday	unknown	4.8.x				hard
