Summary
bug in specialized-io egg
Metadata
- Id: 10037b1ed3a4ef2384450d77e1a85625b7d31c9b
- Trac id: 678
- Type: defect
- Reporter: felix
- Owner: jeronimo
- Cc:
- Status: closed
- Component: extensions
- Estimated difficulty:
- Resolution: worksforme
- Priority: major
- Milestone:
- Version: 4.7.x
- Changetime: 2011-09-04 22:21:19 UTC
- Created: 2011-08-31 12:45:12 UTC
- Keywords: specialized-io
Description
The foreign code should probably be declared to return `int`:
(define write-one-char
(lambda (c port)
(if (fx= 1 ((foreign-lambda* void ((char var)
(scheme-object port))
"#include <stdio.h> \n"
"if (fputc (var, C_port_file(port)) == EOF)"
" return(1);"
"else"
" return(0);")
c port))
(specialized-io-error "write-one-char: failed!"))))
Changes and comments
[2011-08-31 20:58:35 UTC] mario changed status from new to assigned
[2011-08-31 20:58:35 UTC] mario set owner to jeronimo
[2011-09-04 22:21:19 UTC] jeronimo changed status from assigned to closed
[2011-09-04 22:21:19 UTC] jeronimo set resolution to worksforme
[2011-09-04 22:21:19 UTC] jeronimo wrote:
Hi,
Indeed, the void declaration made no sense! It's fixed in trunk and in version 1.2.
However, specialized-io is unsafe in order to be fast, and trying to write to something that is not a port will crash the program.
The verification done is for the case when one tries to write to a closed port or to an input port.