Re: Lintian check for OCaml custom bytecode executables
Stéphane Glondu a écrit :
> I've implemented this check in the attached patch.
Here is an updated patch, thanks to Raphael Geissert's comments.
Cheers,
--
Stéphane
>From c61138eb5e629d6f245ccd72f3070e4e8805b9fe Mon Sep 17 00:00:00 2001
From: Stephane Glondu <steph@glondu.net>
Date: Sun, 19 Jul 2009 11:23:40 +0200
Subject: [PATCH 1/5] Add check for ocaml-custom-executable (Closes: #498138)
Remove also the previous check based on ELF symbols (but not working)
that was supposed to remove the error unstripped-binary-or-object for
such files. To summarize, this patch turns the
unstripped-binary-or-object tags into ocaml-custom-executable warnings
for OCaml custom bytecode executables.
Signed-off-by: Stephane Glondu <steph@glondu.net>
---
checks/binaries | 17 +++++++++++------
checks/binaries.desc | 8 ++++++++
lib/Lintian/Collect/Binary.pm | 4 ----
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/checks/binaries b/checks/binaries
index 83fb858..1b3e60d 100644
--- a/checks/binaries
+++ b/checks/binaries
@@ -228,14 +228,22 @@ foreach my $file (sort keys %{$info->file_info}) {
}
}
+ my $strings = slurp_entire_file("strings/$file");
+ spelling_check('spelling-error-in-binary', $strings, $file);
+
# stripped?
if ($fileinfo =~ m,not stripped\s*$,o) {
# Is it an object file (which generally can not be stripped),
# a kernel module, debugging symbols, or perhaps a debugging package?
- # Ocaml executables are exempted, see #252695
unless ($file =~ m,\.k?o$, or $pkg =~ m/-dbg$/ or $pkg =~ m/debug/
- or $file =~ m,/lib/debug/, or exists $objdump->{OCAML}) {
- tag "unstripped-binary-or-object", "$file";
+ or $file =~ m,/lib/debug/,) {
+ if ($fileinfo =~ m/executable/
+ and $strings =~ m/^Caml1999X0[0-9][0-9]$/m) {
+ # Check for OCaml custom executables (#498138)
+ tag "ocaml-custom-executable", $file;
+ } else {
+ tag "unstripped-binary-or-object", "$file";
+ }
}
} else {
# stripped but a debug or profiling library?
@@ -262,9 +270,6 @@ foreach my $file (sort keys %{$info->file_info}) {
}
}
- my $strings = slurp_entire_file("strings/$file");
- spelling_check('spelling-error-in-binary', $strings, $file);
-
if ($pkg !~ m/^zlib.+/
and $strings =~ /(?:in|de)flate (?:\d[ \w.\-]{1,20}[\w.\-])/m) {
tag "embedded-zlib", $file;
diff --git a/checks/binaries.desc b/checks/binaries.desc
index 3cd3569..2322b9a 100644
--- a/checks/binaries.desc
+++ b/checks/binaries.desc
@@ -257,3 +257,11 @@ Info: The given debugging symbols-only object is installed directly in
<tt>/usr/bin</tt> should be placed in <tt>/usr/lib/debug/usr/bin</tt>.
gdb, when looking for debugging symbols, prepends <tt>/usr/lib/debug</tt>
to the path of the original binary.
+
+Tag: ocaml-custom-executable
+Severity: normal
+Certainty: possible
+Info: This package provides an OCaml bytecode executable linked with a
+ custom runtime. Such executables cannot be stripped and require
+ special care. Their usage is deprecated in favour of shared libraries
+ for C stubs (dll*.so).
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index fbfe053..1661d41 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -204,10 +204,6 @@ sub objdump_info {
if (m/^[0-9a-fA-F]+.{6}\w\w?\s+(\S+)\s+[0-9a-zA-Z]+\s+(\S+)\s+(\S+)$/){
my ($foo, $sec, $sym) = ($1, $2, $3);
push @{$file->{SYMBOLS}}, [ $foo, $sec, $sym ];
-
- if ($foo eq '.text' and $sec eq 'Base' and $sym eq 'caml_main') {
- $file->{OCAML} = 1;
- }
}
} else {
if (m/^\s*NEEDED\s*(\S+)/o) {
--
1.6.3.3
Reply to: