id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
23	`setSocketOption' fails with `Linger' option	vvv		"[http://hackage.haskell.org/packages/archive/network/2.2.1.5/doc/html/Network-Socket.html#v%3AsetSocketOption setSocketOption]
uses FFI binding to ''setsockopt(2)'':

{{{
foreign import CALLCONV unsafe ""setsockopt""
  c_setsockopt :: CInt -> CInt -> CInt -> Ptr CInt -> CInt -> IO CInt
}}}

This binding treats OPTVAL (4th argument) as a pointer to `int'. This
is fine in most cases excepting the one when `SO_LINGER' option is
being set. In the latter case OPTVAL must be a pointer to `struct
linger'. (See [http://www.gnu.org/s/libc/manual/html_node/Socket_002dLevel-Options.html libc manual].)

Haskell programs that try to set SO_LINGER socket option will
successfully compile but '''fail in runtime''':

{{{
$ runhaskell socket-linger.hs || echo X
$ runhaskell -DLINGER socket-linger.hs || echo X
socket-linger.hs: setSocketOption: invalid argument (Invalid argument)
X

$ gcc -g -Wall -W -o /tmp/1 socket-linger.c && /tmp/1 || echo X
$ gcc -g -DLINGER_AS_INT -Wall -W -o /tmp/1 socket-linger.c && /tmp/1 \
  || echo X
setsockopt: Invalid argument
X
}}}

(See the code of [http://hpaste.org/fastcgi/hpaste.fcgi/view?id=14125#a14125 socket-linger.hs]
and [http://hpaste.org/fastcgi/hpaste.fcgi/view?id=14125#a14127 socket-linger.c].)

Still, the necessity of `SO_LINGER' option is
[http://www.developerweb.net/forum/archive/index.php/t-2982.html controversial].
I think we better just remove `Linger' constructor from
`Network/Socket.hsc'.
"	defect	new	minor		network				
