caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Bruno.Verlyck@inria.fr
To: jgoerzen@complete.org
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Cash broken?
Date: Fri, 28 May 2004 12:26:15 +0200	[thread overview]
Message-ID: <200405281026.i4SAQFmR031229@waco.inria.fr> (raw)
In-Reply-To: <20040527193823.GA12789@excelhustler.com> (jgoerzen@complete.org)

[-- 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) })
  ;

  reply	other threads:[~2004-05-28 10:26 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 [this message]
2004-05-28 13:13   ` John Goerzen
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=200405281026.i4SAQFmR031229@waco.inria.fr \
    --to=bruno.verlyck@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=jgoerzen@complete.org \
    /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;
as well as URLs for NNTP newsgroup(s).