From: John Goerzen <jgoerzen@complete.org>
To: Bruno.Verlyck@inria.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Cash broken?
Date: Fri, 28 May 2004 08:13:39 -0500 [thread overview]
Message-ID: <20040528131339.GC9268@excelhustler.com> (raw)
In-Reply-To: <200405281026.i4SAQFmR031229@waco.inria.fr>
[-- 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 --]
next prev parent reply other threads:[~2004-05-28 13:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-27 19:38 John Goerzen
2004-05-28 10:26 ` Bruno.Verlyck
2004-05-28 13:13 ` John Goerzen [this message]
2004-05-28 13:52 ` Bruno.Verlyck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040528131339.GC9268@excelhustler.com \
--to=jgoerzen@complete.org \
--cc=Bruno.Verlyck@inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox