segmentation faults on net-select

Started by newdep, April 16, 2005, 05:11:22 AM

Previous topic - Next topic

newdep

Hi Lutz,



newlisp linux 8.5.3 (or since 8.5.0)



Im not quiet sure yet but i think its related to an empty list!



when net-select does anything on an empty variable/list im

getting sometimes a segmentation fault... like ->



(setq the-list '())

(until (net-error)

         ...

        (dolist (x (net-select the-list "r" 1000))

            (something))

)





Norman.
-- (define? (Cornflakes))

Lutz

#1
In 8.5.0 and previous versions (back to 8.3.2) it was not safe to change the list 'dolist' was iterating through and one would use a copy for iterating. In 8.5.3 this is safe. Can you find out exactly which version works and not works and send me an example (as small as possible) ?



Lutz

newdep

#2
Hi Lutz,



Well actualy the example is quit simple , see below.

It looks like 'select on empty lists simply goes wrong.

It already fails during the start of the script



I tested it back to 8.2.6 but they all do a segmentation fault..



(setq  clients '())

(setq connection (net-listen 54054 "127.0.0.1"))



(until icecream-is-melting



        (if (net-select connection "r" 1000)

            (setq id (net-accept connection))

            (push clients id ))



        (dolist (client (net-select clients "r" 1000)) )

        (dolist (client (net-select clients "w" 1000)) )

)





---> if I do this... then it works -->

(if (not (empty? clients))  (dolist (client (net-select clients "r" 1000)) ))

(if (not (empty? clients))  (dolist (client (net-select clients "w" 1000)) ))





Norman.
-- (define? (Cornflakes))

Lutz

#3
This is fixed in version 8.5.4:



http://newlisp.org/downloads/development/">http://newlisp.org/downloads/development/



Lutz