Hello Sylvain,

> The solution we discussed was to find a test that can tell us what
> binaries are "ocamlc -custom" executable. If we can find them, we can
> warn packager that it should be rebuild without the deprecated option.
> To detect these files we must have a very simple script, lets call it
> "ocaml-custom-detect". The best option is that this script will be
> written using "sh" or "perl" (maybe having an ocaml executable is
> also be ok, we must see what is the easiest way). 
> 
> At OCaml Meeting, Xavier Leroy told me that there was a way to detect
> it. 
> 
> Can M. Leroy provides us with more details for detection?

Basically, a mixed bytecode/native executable produced by ocamlc -custom
is characterized by being a native executable (i.e. produced by gcc)
concatenated with a piece of OCaml bytecode, recognizable by the fact
that it has the magic number "Caml1999X008" at the *end* of the file.

(The last digit of the magic number changed during the life of OCaml,
but it's been "8" since June 2004, and I don't expect it to change any
time soon.  If you want to play it safe, recognize the regexp
"Caml1999X0[0-9][0-9]".)

So, here is a trivial implementation of the ocaml-custom-detect tool
you proposed:

#!/bin/sh

if file $1 | grep -q 'ELF .* executable' \
&& test `tail -c 12 $1` = "Caml1999X008"; then
  echo "$1: is a Caml bytecode/native mixed executable"
  exit 0
else
  exit 1
fi

> Once we have "ocaml-custom-detect", we can:
> - add a policy rules telling that building executable using "-custom" is
>   an ERROR
> - provide a test for this policy rules to "lintian" (Debian package
>   policy checker)

I don't know how serious such ERRORs are.  My humble opinion is that a
positive on the -custom test should be reported to the packagers and
probably to upstream as well, but is not serious enough to
e.g. prevent the package from entering "stable" or whatnot.  Of
course, the policies are up to you Debian guys.

Best regards,

- Xavier Leroy



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to