segmentation faults on net-select

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

segmentation faults on net-select

Post by 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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

This is fixed in version 8.5.4:

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

Lutz

Locked