ocamlrpcgen no longer works on Gutsy. Probably a wrongly stripped binary

Bug #180364 reported by David MENTRÉ
4
Affects Status Importance Assigned to Milestone
ocamlnet (Ubuntu)
Fix Released
Undecided
Martin Pitt
pkg-create-dbgsym (Ubuntu)
Fix Released
Undecided
Martin Pitt

Bug Description

Hello,

The command line options of ocamlrpcgen (from libocamlnet-ocaml-bin package) no longer work on Gutsy (there were no issues on Feisty).

$ ocamlrpcgen -cpp none -int unboxed -hyper int64 -aux net/messages.xdr
Unknown option -cpp.
$ ocamlrpcgen -int unboxed -hyper int64 -aux net/messages.xdr
Unknown option -int.
$ ocamlrpcgen -hyper int64 -aux net/messages.xdr
Unknown option -hyper.

After a post on <email address hidden> mailing list, it seems that this is due to a wrongly stripped binary. OCaml binaries should *never* been stripped because strip removes the embedded bytecode.
  http://lists.debian.org/debian-ocaml-maint/2008/01/msg00039.html

This is confirmed by following command:
$ ocamlrpcgen net/messages.xdr
Fatal error: the file net/messages.xdr is not a bytecode executable file

Currently libocamlnet-ocaml-bin package is broken on Gutsy (and probably others if other OCaml binaries are stripped).

Yours,
d.

Revision history for this message
David MENTRÉ (dmentre) wrote :

A Debian developer (Stefano Zacchiroli) suggested that the unneeded strip was done at package building: http://lists.debian.org/debian-ocaml-maint/2008/01/msg00061.html

Unfortunately, after looking at the .deb patch applied to the original package (http://archive.ubuntu.com/ubuntu/pool/universe/o/ocamlnet/ocamlnet_2.2.7-1.diff.gz), the Ubuntu package seems to have the relevant DEB_STRIP_EXCLUDE lines:
+DEB_STRIP_EXCLUDE += usr/bin/netplex-admin # OCaml custom bytecode binaries can't be striped
+DEB_STRIP_EXCLUDE += usr/bin/ocamlrpcgen

So maybe the stripping is done at another level or the DEB_STRIP_EXCLUDE rule is not taken into account. I don't know.

Revision history for this message
Michael Bienia (geser) wrote :

Can you provide a test file so I can check if it's fixed in hardy? (I'm no ocaml programmer).

Revision history for this message
David MENTRÉ (dmentre) wrote :

Here is a test file. Use it with following command line:

  ocamlrpcgen -cpp none -int unboxed -hyper int64 -aux messages.xdr

It should produce several messages_*.ml and messages_*.mli files.

Revision history for this message
Martin Pitt (pitti) wrote :

Seems that merely adding a .gnu_debuglink ELF section breaks the binaries. Meh :/

We need to fix that in pkg-create-dbgsym. There needs to be a robust way to detect such a binary. Do they have a special section (objdump -x or readelf -h)?

Changed in pkg-create-dbgsym:
assignee: nobody → pitti
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

seems that this is a working test:

  objdump -x binary | grep -qw caml_release_bytecode

Revision history for this message
Martin Pitt (pitti) wrote :

objdump -t binary is sufficient, too.

Revision history for this message
David MENTRÉ (dmentre) wrote :

Hello Martin,

I've asked to OCaml developers. Xavier Leroy, lead OCaml developer, told me that:
 * the "objdump -x binary | grep -qw caml_release_bytecode" or "objdump -t binary" patterns could be used;
 * it would be better also to test an OCaml magic number at the last 12 bytes of the binary. The magic pattern to match is "Caml1999X[0-9][0-9][0-9]". So a

  tail -c 12 | egrep -q "Caml1999X[0-9][0-9][0-9]"

should do the trick.

Yours,
d.

Revision history for this message
Martin Pitt (pitti) wrote :

I think I'll fix this completely differently: I'll fix the dh_strip wrapper to pass the set of ignored files (-X file) to pkg_create_dbgsym, and have that one not touch any ignored file.

Revision history for this message
David MENTRÉ (dmentre) wrote : Re: [Bug 180364] Re: ocamlrpcgen no longer works on Gutsy. Probably a wrongly stripped binary

Hello Martin,

2008/1/14, Martin Pitt <email address hidden>:
> I think I'll fix this completely differently: I'll fix the dh_strip
> wrapper to pass the set of ignored files (-X file) to pkg_create_dbgsym,
> and have that one not touch any ignored file.

Should this list of ignored files be manually updated or is it an
automatic process?

Let me know if I can test new packages.

Yours,
d.

Revision history for this message
Michael Bienia (geser) wrote :

The package specifies already that usr/bin/netplex-admin and usr/bin/ocamlrpcgen shouldn't be stripped. The problem is that pkg_create_dbgsym didn't have this information and added a link to the debug symbols (although those binaries doesn't get stripped later) and that broke those binaries too.
The fix is now to pass this information to pkg_create_dbgsym so it doesn't try to add that link to the debug symbols for package which are stripped later anyway.
Once pkg_create_dbgsym is fixed, a (no-change) rebuild of ocamlnet is necessary to fix the package too.

Revision history for this message
Martin Pitt (pitti) wrote :

Will do a no-change upload once the fixed pkg-create-dbgsym is built and in the archive.

Changed in ocamlnet:
assignee: nobody → pitti
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pkg-create-dbgsym - 0.24

---------------
pkg-create-dbgsym (0.24) hardy; urgency=low

  * Add tests/dhtest.nostrip: Ignore crash2 for dh_strip, and add an assertion
    that the file isn't touched by dh_strip. This reproduces LP #180364.
  * Parse dh_strip's -X options in the wrapper and pass them to
    pkg_create_dbgsym. Do not touch any files which match these patterns. This
    avoids adding GNU debuglinks to ELF binaries which must not be touched at
    all, like Ocaml bytecode. (LP: #180364)
  * tests/run: Do not expect a dbgsym package for test .debs with 'nostrip' in
    the name (as used by the tests/dhtest.nostrip test case).

 -- Martin Pitt <email address hidden> Thu, 21 Feb 2008 17:55:07 +0100

Changed in pkg-create-dbgsym:
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ocamlnet - 2.2.8.1-1build1

---------------
ocamlnet (2.2.8.1-1build1) hardy; urgency=low

  * No-change rebuild against fixed pkg-create-dbgsym. (LP: #180364)

 -- Martin Pitt <email address hidden> Fri, 22 Feb 2008 12:08:34 +0100

Changed in ocamlnet:
status: In Progress → Fix Released
Revision history for this message
David MENTRÉ (dmentre) wrote :

Hello,

Launchpad Bug Tracker <email address hidden> writes:

> This bug was fixed in the package ocamlnet - 2.2.8.1-1build1

Unfortunatly, the bug is not fixed.

Even with package version 2.2.8.1-1build1, program ocamlrpcgen is still
broken. :-(

(hardy-chroot)david@morgana:~$ dpkg -l *ocamlnet*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-========================-========================-================================================================
ii libocamlnet-ocaml 2.2.8.1-1build1 OCaml application-level Internet libraries - core runtime librar
ii libocamlnet-ocaml-bin 2.2.8.1-1build1 OCaml application-level Internet libraries - binaries
ii libocamlnet-ocaml-dev 2.2.8.1-1build1 OCaml application-level Internet libraries - core development li
un libocamlnet-ocaml-doc <none> (no description available)

(hardy-chroot)david@morgana:~$ ocamlrpcgen
No bytecode file specified.

(hardy-chroot)david@morgana:~$ ocamlrpcgen --help
Unknown option --help.

Here is the expected behavior (in Debian Etch):

(etch-chroot)root@morgana:/# ocamlrpcgen --help
usage: ocamlrpcgen [-aux] [-clnt] [-srv]
                   [-int (abstract | int32 | unboxed) ]
                   [-hyper (abstract | int64 | unboxed) ]
[...]

Sincerely yours,
david
--
GPG/PGP key: A3AD7A2A -- <email address hidden>
 5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A

Revision history for this message
Martin Pitt (pitti) wrote :

Not quite fixed yet, pkg-create-dbgsym needs to get along with spaces between -X and the pattern.

Changed in pkg-create-dbgsym:
status: Fix Released → In Progress
Changed in ocamlnet:
status: Fix Released → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pkg-create-dbgsym - 0.25

---------------
pkg-create-dbgsym (0.25) hardy; urgency=low

  * tests/dhtest.nostrip: Add another test case for dh_strip blacklisting with
    a space between -X and the argument. This reproduces the followup problem
    in LP #180364.
  * dh_strip: Fix option parsing to get along with spaces between -X and the
    argument. (LP: #180364)

 -- Martin Pitt <email address hidden> Tue, 26 Feb 2008 16:05:28 +0100

Changed in pkg-create-dbgsym:
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ocamlnet - 2.2.8.1-1build2

---------------
ocamlnet (2.2.8.1-1build2) hardy; urgency=low

  * No-change rebuild against even more fixed pkg-create-dbgsym. (LP: #180364)

 -- Martin Pitt <email address hidden> Wed, 27 Feb 2008 11:26:35 +0100

Changed in ocamlnet:
status: In Progress → Fix Released
Revision history for this message
David MENTRÉ (dmentre) wrote :

Hello,

Launchpad Bug Tracker <email address hidden> writes:

> This bug was fixed in the package ocamlnet - 2.2.8.1-1build2

I confirm the bug is fixed in this package. Many thanks Martin!

Yours,
d.
--
GPG/PGP key: A3AD7A2A -- <email address hidden>
 5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.