caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe TROESTLER <debian00@tiscali.fr>
To: OCaml Mailing List <caml-list@inria.fr>
Subject: toplevel "I/O error: Bad file descriptor" loop
Date: Fri, 17 Mar 2006 20:30:16 +0100 (CET)	[thread overview]
Message-ID: <20060317.203016.231069790.debian00@tiscali.fr> (raw)

Hi,

I have put together the following simple binding to libmagic:
https://sourceforge.net/projects/ocaml-magic/ Everything works fine
with bytecode and native code compiled programs but, when I try it in
the toplevel to query a non existing file or a special device, I get a
looping "I/O error: Bad file descriptor" message.  Example:

  # let c = Magic.create [];;
  val c : Magic.t = <abstr>
  # let m1 = Magic.file c "dllmagic_stub.so";;
  val m1 : string =
    "ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped"

So far everything is fine.

  # let m3 = Magic.file c "/dev/null";;
  val m3 : string = "character special (1/3)"
  # I/O error: Bad file descriptor

The last message is returned in a loop by the system.

  # let m4 = Magic.file c "xxx";;

The same thing happens if "xxx" does not exists.

Has anybody an idea where to look for the cause of this problem?  I
looked into libmagic code but the one dealing with file system magic
(fsmagic.c) seems to only perform an unharmful stat/lstat and not
touch stdout.

Best regards,
ChriS


                 reply	other threads:[~2006-03-17 19:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060317.203016.231069790.debian00@tiscali.fr \
    --to=debian00@tiscali.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;
as well as URLs for NNTP newsgroup(s).