chicken-janitors
[Top][All Lists]
Advanced

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

Re: [Chicken-janitors] #985: read-line blocks intermittantly on Atom bas


From: Chicken Trac
Subject: Re: [Chicken-janitors] #985: read-line blocks intermittantly on Atom based netbook
Date: Tue, 19 Feb 2013 05:29:40 -0000

#985: read-line blocks intermittantly on Atom based netbook
----------------------+-----------------------------------------------------
  Reporter:  kiatoa   |       Owner:         
      Type:  defect   |      Status:  new    
  Priority:  minor    |   Milestone:  someday
 Component:  unknown  |     Version:  4.8.x  
Resolution:           |    Keywords:         
----------------------+-----------------------------------------------------

Comment(by kiatoa):

 Replying to [ticket:985 kiatoa]:
 > This problem first shows up in:
 >
 > 9eef92115fba6034a98cc21ef740fd82ea52387b is the first bad commit
 > commit 9eef92115fba6034a98cc21ef740fd82ea52387b
 > Author: Peter Bex <address@hidden>
 > 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"))
 >

 To trigger the issue I ran the above code 10-20 times in a row. Generally
 the problem would show up in the first or second run but sometimes it
 would take many iterations before the problem occurred.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/985#comment:1>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

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