[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#498138: check for deprecated OCaml -custom linked executable



Package: lintian
Severity: wishlist

The OCaml compiler enables linking code in various ways: most notably
bytecode and nativecode. The bytecode executables though can be linked
together with the interpreter (the so called "custom mode"), generating
ELF executables which can not be stripped.  Since long time there is a
better alternative to that and we would like to encourage that.

As such, we would like to add a lintian check to warn against OCaml
custom mode executable. They can easily detected by looking for a magic
number at the end of the file, as described in the forwarded mail from
upstream.

Before actually providing a lintian check for that, I would like to know
from the lintian maintainers if the magic number is enough for them, or
if they consider it too prone to false positives. Please let us know.

TIA,
Cheers.

On Wed, Aug 20, 2008 at 05:10:06PM +0200, Xavier Leroy wrote:
> 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 debian-ocaml-maint-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 

-- 
Stefano Zacchiroli -*- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
I'm still an SGML person,this newfangled /\ All one has to do is hit the
XML stuff is so ... simplistic  -- Manoj \/ right keys at the right time

Attachment: signature.asc
Description: Digital signature


Reply to: