* tasks call-with-output-string segv
@ 2003-09-13 1:25 Kevin Ryde
2003-09-13 2:45 ` Rob Browning
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2003-09-13 1:25 UTC (permalink / raw)
I added to the todo list under 1.6 from what Nic Ferrier reported on
guile-user,
- call-with-output-string seg faults if its port is closed, eg.
(call-with-output-string close-port)
What should happen? Should this be an error, or should it be
possible to get the string out of a closed string port?
[Same situation in the cvs head.]
I don't know what call-with-output-string ought to do in this case,
but a segv is certainly not it :-).
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: tasks call-with-output-string segv
2003-09-13 1:25 tasks call-with-output-string segv Kevin Ryde
@ 2003-09-13 2:45 ` Rob Browning
2003-09-23 23:51 ` Kevin Ryde
0 siblings, 1 reply; 6+ messages in thread
From: Rob Browning @ 2003-09-13 2:45 UTC (permalink / raw)
Kevin Ryde <user42@zip.com.au> writes:
> I added to the todo list under 1.6 from what Nic Ferrier reported on
> guile-user,
>
> - call-with-output-string seg faults if its port is closed, eg.
> (call-with-output-string close-port)
> What should happen? Should this be an error, or should it be
> possible to get the string out of a closed string port?
> [Same situation in the cvs head.]
>
>
> I don't know what call-with-output-string ought to do in this case,
> but a segv is certainly not it :-).
Offhand, I'd guess some kind of exception would be in order.
--
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: tasks call-with-output-string segv
2003-09-13 2:45 ` Rob Browning
@ 2003-09-23 23:51 ` Kevin Ryde
2003-10-01 17:29 ` Rob Browning
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2003-09-23 23:51 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
Rob Browning <rlb@defaultvalue.org> writes:
>
> Offhand, I'd guess some kind of exception would be in order.
* strports.c (scm_call_with_output_string): scm_get_output_string
rather than scm_strport_to_string, so as to guard against the port
having been closed by the called procedure.
* tests/ports.test (call-with-output-string): Test proc closing port.
* scheme-io.texi (String Ports): In call-with-output-string, note proc
should not close the port. In get-output-string, note string must be
gotten before closing the port.
This would be a candidate for the 1.6 branch too, if the solution
seems ok.
[-- Attachment #2: strports.c.call-out.diff --]
[-- Type: text/plain, Size: 288 bytes --]
--- strports.c.~1.98.~ 1970-01-01 10:00:01.000000000 +1000
+++ strports.c 2003-09-22 13:39:47.000000000 +1000
@@ -333,7 +333,7 @@
FUNC_NAME);
scm_call_1 (proc, p);
- return scm_strport_to_string (p);
+ return scm_get_output_string (p);
}
#undef FUNC_NAME
[-- Attachment #3: ports.test.csc.diff --]
[-- Type: text/plain, Size: 497 bytes --]
--- ports.test.~1.28.~ 1970-01-01 10:00:01.000000000 +1000
+++ ports.test 2003-09-22 13:49:23.000000000 +1000
@@ -301,6 +301,14 @@
(pass-if "output check"
(string=? text result))))
+(with-test-prefix "call-with-output-string"
+
+ ;; In Guile 1.6.4, closing the port resulted in a segv, check that doesn't
+ ;; occur.
+ (pass-if-exception "proc closes port" exception:wrong-type-arg
+ (call-with-output-string close-port)))
+
+
\f
;;;; Soft ports. No tests implemented yet.
[-- Attachment #4: scheme-io.texi.str-close.diff --]
[-- Type: text/plain, Size: 889 bytes --]
--- scheme-io.texi.~1.15.~ 1970-01-01 10:00:01.000000000 +1000
+++ scheme-io.texi 2003-09-22 14:56:31.000000000 +1000
@@ -798,7 +798,7 @@
@deffnx {C Function} scm_call_with_output_string (proc)
Calls the one-argument procedure @var{proc} with a newly created output
port. When the function returns, the string composed of the characters
-written into the port is returned.
+written into the port is returned. @var{proc} should not close the port.
@end deffn
@deffn {Scheme Procedure} call-with-input-string string proc
@@ -842,6 +842,9 @@
Given an output port created by @code{open-output-string},
return a string consisting of the characters that have been
output to the port so far.
+
+@code{get-output-string} must be used before closing @var{port}, once
+closed the string cannot be obtained.
@end deffn
A string port can be used in many procedures which accept a port
[-- Attachment #5: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: tasks call-with-output-string segv
2003-09-23 23:51 ` Kevin Ryde
@ 2003-10-01 17:29 ` Rob Browning
2003-10-02 1:21 ` Kevin Ryde
0 siblings, 1 reply; 6+ messages in thread
From: Rob Browning @ 2003-10-01 17:29 UTC (permalink / raw)
Kevin Ryde <user42@zip.com.au> writes:
> This would be a candidate for the 1.6 branch too, if the solution
> seems ok.
Yes, that looks good. Please commit it if you have time.
--
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: tasks call-with-output-string segv
2003-10-01 17:29 ` Rob Browning
@ 2003-10-02 1:21 ` Kevin Ryde
2003-10-02 1:41 ` Rob Browning
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2003-10-02 1:21 UTC (permalink / raw)
Cc: guile-devel
Rob Browning <rlb@defaultvalue.org> writes:
>
> Yes, that looks good. Please commit it if you have time.
Done.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: tasks call-with-output-string segv
2003-10-02 1:21 ` Kevin Ryde
@ 2003-10-02 1:41 ` Rob Browning
0 siblings, 0 replies; 6+ messages in thread
From: Rob Browning @ 2003-10-02 1:41 UTC (permalink / raw)
Kevin Ryde <user42@zip.com.au> writes:
> Done.
Thanks. After I hear back about the cygwin patch, and we do
whatever's needed, I'll start working on the release.
--
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-10-02 1:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-13 1:25 tasks call-with-output-string segv Kevin Ryde
2003-09-13 2:45 ` Rob Browning
2003-09-23 23:51 ` Kevin Ryde
2003-10-01 17:29 ` Rob Browning
2003-10-02 1:21 ` Kevin Ryde
2003-10-02 1:41 ` Rob Browning
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).