Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] different results with two identical copies of a script

Expand Messages
  • Ashish Agarwal
    Since the names of script are the only thing that differ, that s one thing to consider. However, I can t find a pattern: install_apps.ml - error installapps.ml
    Message 1 of 2 , Mar 18, 2011
    • 0 Attachment
      Since the names of script are the only thing that differ, that's one thing
      to consider. However, I can't find a pattern:

      install_apps.ml - error
      installapps.ml - okay
      tmp.ml - okay
      tmp_2.ml - okay

      Also, I use the same script in another project, where this problem occurred
      temporarily but then went away, even with the name install_apps.ml.


      On Fri, Mar 18, 2011 at 11:12 AM, Ashish Agarwal <agarwal1975@...>wrote:

      > I get the error:
      >
      > Fatal error: exception
      > Sys_error("/share/apps/ocaml/share/camomile/database/general_category.mar:
      > No such file or directory")
      >
      > when using batteries in a simple ocamlscript. However, two identical copies
      > of this script give different results. One causes the above error, the
      > other
      > doesn't. So the issue is not about batteries, camomile, or ocamlscript. I'm
      > not sure what could cause this:
      >
      > $ bin/tmp.ml src/_build/app ~/bin/sequme
      > � script runs correctly, outputs some messages about which files are being
      > copied ...
      >
      > $ bin/install_apps.ml src/_build/app ~/bin/sequme
      > Fatal error: exception
      > Sys_error("/share/apps/ocaml/share/camomile/database/general_category.mar:
      > No such file or directory")
      > Raised at file "pervasives.ml", line 284, characters 20-46
      >
      > $ diff bin/tmp.ml bin/install_apps.ml
      > � no output, the scripts are identical �
      >
      > Since some files got copied in the first run, perhaps that is what causes
      > the second run of the script to behave differently. To confirm, I ran each
      > again in different order.
      >
      > $ bin/tmp.ml src/_build/app ~/bin/sequme
      > � script runs correctly ...
      >
      > $ bin/install_apps.ml src/_build/app ~/bin/sequme
      > Fatal error: exception
      > Sys_error("/share/apps/ocaml/share/camomile/database/general_category.mar:
      > No such file or directory")
      > Raised at file "pervasives.ml", line 284, characters 20-46
      >
      > $ bin/install_apps.ml src/_build/app ~/bin/sequme
      > Fatal error: exception
      > Sys_error("/share/apps/ocaml/share/camomile/database/general_category.mar:
      > No such file or directory")
      > Raised at file "pervasives.ml", line 284, characters 20-46
      >
      > $ bin/tmp.ml src/_build/app ~/bin/sequme
      > � script runs correctly �
      >
      > $ diff bin/tmp.ml bin/install_apps.ml
      > � make absolutely sure scripts are still the same, confirmed �
      >
      > Here's the entire script. It just copies compiled binaries from a source to
      > destination directory if the files in the source directory are newer, and
      > also strips off the .native extension.
      >
      > ----- install_apps.ml (tmp.ml) ----
      > #! /usr/bin/env ocamlscript
      > Ocaml.packs := ["batteries"]
      > --
      >
      > open Batteries_uni;; open Printf
      >
      > let run cmd =
      > print_endline cmd;
      > let errcode = Sys.command cmd in
      > if errcode = 0 then ()
      > else exit errcode
      >
      > let cp src dstdir =
      > let open Filename in
      > let dst = src |> basename |> flip chop_suffix ".native" |> concat dstdir
      > in
      > let cmd = sprintf "cp -f %s %s" src dst in
      > let open Unix in
      > if not (Sys.file_exists dst) || (stat src).st_mtime > (stat dst).st_mtime
      > then
      > run cmd
      >
      > let srcdir = Sys.argv.(1)
      > let dstdir = Sys.argv.(2)
      > let apps =
      > srcdir |> Sys.readdir |> Array.to_list
      > |> List.filter (flip Filename.check_suffix ".native")
      > |> List.map (Filename.concat srcdir)
      >
      > let _ = List.iter (flip cp dstdir) apps
      >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      > ------------------------------------
      >
      > Archives up to December 31, 2010 are also downloadable at
      > http://www.connettivo.net/cntprojects/ocaml_beginners
      > The archives of the very official ocaml list (the seniors' one) can be
      > found at http://caml.inria.fr
      > Attachments are banned and you're asked to be polite, avoid flames
      > etc.Yahoo! Groups Links
      >
      >
      >
      >


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.