* bug#23000: send doesn't check for closed socket
@ 2016-03-12 18:57 Amirouche Boubekki
2016-05-03 9:07 ` bug#23000: update from wingo Amirouche Boubekki
0 siblings, 1 reply; 3+ messages in thread
From: Amirouche Boubekki @ 2016-03-12 18:57 UTC (permalink / raw)
To: 23000
[-- Attachment #1: Type: text/plain, Size: 273 bytes --]
The attached client.scm will crash with a SIGPIPE (based on strace) when
run. It should raise an error instead.
The error happens when we try to send over socket that is closed on the
other side.
Happens on 2.0 and master.
--
Amirouche ~ amz3 ~ http://www.hyperdev.fr
[-- Attachment #2: client.scm --]
[-- Type: text/plain, Size: 377 bytes --]
(define-module (client))
(use-modules (shared))
(define (client)
(define socket (make-client-socket 12348))
(pk (send socket (list->u64vector (iota 3))))
(pk (recv socket))
(pk "sleeping")
(sleep 15)
(pk (send socket (list->u64vector (iota 3))))
(pk (send socket (list->u64vector (iota 3))))
(pk (close socket))
(pk "bye"))
(client)
(pk "end of program")
[-- Attachment #3: shared.scm --]
[-- Type: text/plain, Size: 681 bytes --]
(define-module (shared))
(use-modules (rnrs io ports))
(define-public (recv port)
(let next ((out '()))
(if (char-ready? port)
(let ((byte (get-u8 port)))
(if (eof-object? byte)
(reverse out)
(next (cons byte out))))
(reverse out))))
(define make-socket socket)
(define-public (make-client-socket port)
(let ((socket (make-socket PF_INET SOCK_STREAM 0)))
(connect socket AF_INET INADDR_LOOPBACK port)
socket))
(define-public (make-server-socket port)
(let ((socket (make-socket PF_INET SOCK_STREAM 0)))
(bind socket (make-socket-address AF_INET INADDR_ANY port))
(listen socket 128)
socket))
[-- Attachment #4: server.scm --]
[-- Type: text/plain, Size: 220 bytes --]
(define-module (server))
(use-modules (shared))
(define (server)
(let* ((sock (make-server-socket 12348))
(client (car (accept sock))))
(pk (recv client))
(close client)
(close sock)))
(server)
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#23000: update from wingo
2016-03-12 18:57 bug#23000: send doesn't check for closed socket Amirouche Boubekki
@ 2016-05-03 9:07 ` Amirouche Boubekki
2016-06-20 16:18 ` Andy Wingo
0 siblings, 1 reply; 3+ messages in thread
From: Amirouche Boubekki @ 2016-05-03 9:07 UTC (permalink / raw)
To: 23000
wingo said:
> wingo | i don't think that's a guile bug -- i think in that case you
> need to handle SIGPIPE
> wingo | b/c posix is weird
> wingo | (sigaction SIGPIPE SIG_IGN)
> wingo | the web server does it.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#23000: update from wingo
2016-05-03 9:07 ` bug#23000: update from wingo Amirouche Boubekki
@ 2016-06-20 16:18 ` Andy Wingo
0 siblings, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2016-06-20 16:18 UTC (permalink / raw)
To: Amirouche Boubekki; +Cc: 23000-done
tags 2300 +notabug
close
thanks
On Tue 03 May 2016 11:07, Amirouche Boubekki <amirouche@hypermove.net> writes:
> wingo said:
>
>> wingo | i don't think that's a guile bug -- i think in that case you
>> need to handle SIGPIPE
>> wingo | b/c posix is weird
>> wingo | (sigaction SIGPIPE SIG_IGN)
>> wingo | the web server does it.
Yep!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-20 16:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-12 18:57 bug#23000: send doesn't check for closed socket Amirouche Boubekki
2016-05-03 9:07 ` bug#23000: update from wingo Amirouche Boubekki
2016-06-20 16:18 ` Andy Wingo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).