* [Caml-list] Cash broken?
@ 2004-05-27 19:38 John Goerzen
2004-05-28 10:26 ` Bruno.Verlyck
0 siblings, 1 reply; 4+ messages in thread
From: John Goerzen @ 2004-05-27 19:38 UTC (permalink / raw)
To: caml-list
I tried this example straight from the docs:
$ cashtop
Objective Caml version 3.07+2
Camlp4 Parsing version 3.07+2
# open Cash;;
# run_with_strings (fun () -> exec_path "ls" []);;
Exception: Sys_error "Bad file descriptor".
# Exception: Sys_error "Bad file descriptor".
I can't make any of the run_with_* that I've tried work, whether in my
programs or with cashtop.
Ideas? (Cash 0.20)
-- John
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Cash broken?
2004-05-27 19:38 [Caml-list] Cash broken? John Goerzen
@ 2004-05-28 10:26 ` Bruno.Verlyck
2004-05-28 13:13 ` John Goerzen
0 siblings, 1 reply; 4+ messages in thread
From: Bruno.Verlyck @ 2004-05-28 10:26 UTC (permalink / raw)
To: jgoerzen; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]
Date: Thu, 27 May 2004 14:38:23 -0500
From: John Goerzen <jgoerzen@complete.org>
Hi John,
I tried this example straight from the docs:
$ cashtop
Objective Caml version 3.07+2
Camlp4 Parsing version 3.07+2
# open Cash;;
# run_with_strings (fun () -> exec_path "ls" []);;
Exception: Sys_error "Bad file descriptor".
# Exception: Sys_error "Bad file descriptor".
I can't make any of the run_with_* that I've tried work, whether in
my programs or with cashtop.
Ideas? (Cash 0.20)
Not a lot with so little info (of course it works here). Would you
mind sending me more OS details ? A backtrace would be very useful,
and/or the result of trace/truss/strace -f ?
That said, what comes to mind is that the behavior of close_{in,out}
has changed in Pervasives over the last versions of Caml. I wrote
some (too many) lines of code to make Cash.close_{in,out} work anyway.
I see in the CVS log that there was a change related to that, some
time after 3.07 (see the attached patch). You could try it, or even
try the entire CVS version of Cash.
Bruno.
[-- Attachment #2: Type: text/plain, Size: 1308 bytes --]
Index: io_3_2.ml
===================================================================
RCS file: /net/pauillac/caml/repository/cash/io_3_2.ml,v
retrieving revision 1.47
retrieving revision 1.48
diff -c -a -r1.47 -r1.48
*** io_3_2.ml 2002/08/05 17:07:37 1.47
--- io_3_2.ml 2002/12/05 17:37:52 1.48
***************
*** 116,126 ****
Some fd ->
let res = low_close_fd fd in (* low_close_fd will tell it. *)
do {
! close_any any_chan; (* Never raise exception in the current implementation. *)
res
} ]
in
(fun ichan -> close (anychan_of_ichan ichan),
fun ochan -> do { flush ochan; close (anychan_of_ochan ochan) })
;
--- 116,129 ----
Some fd ->
let res = low_close_fd fd in (* low_close_fd will tell it. *)
do {
! (* Used to raise no exception, but this varies between implementations... *)
! try close_any any_chan with [ Sys_error "Bad file descriptor" -> () ];
res
} ]
in
(fun ichan -> close (anychan_of_ichan ichan),
+ (* Current religion says: flush do nothing on a closed channel. *)
+ (* Current implication is: if an unflushed channel's fd is closed, it's an error. *)
fun ochan -> do { flush ochan; close (anychan_of_ochan ochan) })
;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Cash broken?
2004-05-28 10:26 ` Bruno.Verlyck
@ 2004-05-28 13:13 ` John Goerzen
2004-05-28 13:52 ` Bruno.Verlyck
0 siblings, 1 reply; 4+ messages in thread
From: John Goerzen @ 2004-05-28 13:13 UTC (permalink / raw)
To: Bruno.Verlyck; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 2699 bytes --]
On Fri, May 28, 2004 at 12:26:15PM +0200, Bruno.Verlyck@inria.fr wrote:
> # open Cash;;
> # run_with_strings (fun () -> exec_path "ls" []);;
> Exception: Sys_error "Bad file descriptor".
> # Exception: Sys_error "Bad file descriptor".
> I can't make any of the run_with_* that I've tried work, whether in
> my programs or with cashtop.
>
> Ideas? (Cash 0.20)
> Not a lot with so little info (of course it works here). Would you
> mind sending me more OS details ? A backtrace would be very useful,
> and/or the result of trace/truss/strace -f ?
This is on Debian sid, Linux 2.6.6. I couldn't figure out how to get a
backtrace. However, from the forked child, I see:
[pid 9461] close(4) = 0
[pid 9461] close(4) = -1 EBADF (Bad file descriptor)
(Full strace attached)
Will try the patch. How does the CVS version rank in terms of
stability?
> That said, what comes to mind is that the behavior of close_{in,out}
> has changed in Pervasives over the last versions of Caml. I wrote
> some (too many) lines of code to make Cash.close_{in,out} work anyway.
> I see in the CVS log that there was a change related to that, some
> time after 3.07 (see the attached patch). You could try it, or even
> try the entire CVS version of Cash.
>
> Bruno.
> Index: io_3_2.ml
> ===================================================================
> RCS file: /net/pauillac/caml/repository/cash/io_3_2.ml,v
> retrieving revision 1.47
> retrieving revision 1.48
> diff -c -a -r1.47 -r1.48
> *** io_3_2.ml 2002/08/05 17:07:37 1.47
> --- io_3_2.ml 2002/12/05 17:37:52 1.48
> ***************
> *** 116,126 ****
> Some fd ->
> let res = low_close_fd fd in (* low_close_fd will tell it. *)
> do {
> ! close_any any_chan; (* Never raise exception in the current implementation. *)
> res
> } ]
> in
> (fun ichan -> close (anychan_of_ichan ichan),
> fun ochan -> do { flush ochan; close (anychan_of_ochan ochan) })
> ;
>
> --- 116,129 ----
> Some fd ->
> let res = low_close_fd fd in (* low_close_fd will tell it. *)
> do {
> ! (* Used to raise no exception, but this varies between implementations... *)
> ! try close_any any_chan with [ Sys_error "Bad file descriptor" -> () ];
> res
> } ]
> in
> (fun ichan -> close (anychan_of_ichan ichan),
> + (* Current religion says: flush do nothing on a closed channel. *)
> + (* Current implication is: if an unflushed channel's fd is closed, it's an error. *)
> fun ochan -> do { flush ochan; close (anychan_of_ochan ochan) })
> ;
[-- Attachment #2: foo.gz --]
[-- Type: application/octet-stream, Size: 4784 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Cash broken?
2004-05-28 13:13 ` John Goerzen
@ 2004-05-28 13:52 ` Bruno.Verlyck
0 siblings, 0 replies; 4+ messages in thread
From: Bruno.Verlyck @ 2004-05-28 13:52 UTC (permalink / raw)
To: jgoerzen; +Cc: caml-list
Date: Fri, 28 May 2004 08:13:39 -0500
From: John Goerzen <jgoerzen@complete.org>
On Fri, May 28, 2004 at 12:26:15PM +0200, Bruno.Verlyck@inria.fr wrote:
> # open Cash;;
> # run_with_strings (fun () -> exec_path "ls" []);;
> Exception: Sys_error "Bad file descriptor".
> # Exception: Sys_error "Bad file descriptor".
> Ideas? (Cash 0.20)
> Would you mind sending me more OS details ? A backtrace would be
> very useful, and/or the result of trace/truss/strace -f ?
This is on Debian sid, Linux 2.6.6. I couldn't figure out how to
get a backtrace. However, from the forked child, I see:
[pid 9461] close(4) = 0
[pid 9461] close(4) = -1 EBADF (Bad file descriptor)
(Full strace attached)
Thank you. It confirms my first guess.
Will try the patch. How does the CVS version rank in terms of
stability?
Pretty good :-). The only risk is that I converted all the sources to
use Cstr/String13, and I have to admit I introduced some translation
errors. I fixed those I found, but it could be that there's still
`just one more bug'. I would be very interested if you (or anyone
else) find it out, or tell me everything you tried is OK.
Thanks anyway,
Bruno.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-28 13:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-27 19:38 [Caml-list] Cash broken? John Goerzen
2004-05-28 10:26 ` Bruno.Verlyck
2004-05-28 13:13 ` John Goerzen
2004-05-28 13:52 ` Bruno.Verlyck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox