Bug#849110: magicrescue builds without dupemap support on Ubuntu

Carlos Maddela e7appew at gmail.com
Thu Dec 22 17:58:49 UTC 2016

Package: magicrescue
Version: 1.1.9-4
Severity: important
Tags: patch

It appears that due to some change in the compiler used by Ubuntu,
magicrescue no longer builds with dupemap support. This is the case
for Yakkety which ships version 1.1.9-3. This is the output you get
when you try to use dupemap:

> dupemap was not compiled because no ndbm.h was found on your system.  Please
> install the development packages for Berkeley DB or GDBM and recompile.

I've tried to determine at what point the dupemap command stopped
working in Ubuntu based on what the current archive has, but this may
not be entirely reliable. Version 1.1.9-2 with a time stamp of
2014-11-04 doesn't work either, but version 1.1.8-1 with a time stamp
of 2009-12-18 does. This is very strange, because I could have sworn
I had a working version towards the end of 2015. Perhaps the packages
they have in the archive have been rebuilt with a newer compiler.
Anyway, if I take the source for the working version (1.1.8-1) and
rebuild the package in Yakkety, dupemap doesn't work either. This would
confirm that the problem is not as a result of a change in the source
code, but a change in the compiler.

I have found that if you tweak the position of the LDFLAGS in the
command used to link binaries, everything works as expected again.
Please take a look at my patch.



-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.7.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages magicrescue depends on:
ii  dcraw                9.27-1
ii  flac                 1.3.1-4
ii  libc6                2.24-8
ii  libgdbm3             1.8.3-14
ii  libjpeg-turbo-progs  1:1.5.1-2
ii  mpg321 [mpg123]      0.3.2-1.1
ii  sqlite3              3.15.2-2
ii  unzip                6.0-21
ii  zip                  3.0-11

magicrescue recommends no packages.

magicrescue suggests no packages.

-- no debconf information
-------------- next part --------------
From: Carlos Maddela <e7appew at gmail.com>
Date: Fri, 23 Dec 2016 02:10:17 +1100
Subject: Fix position of LDFLAGS in link commands.

Description: Fix position of LDFLAGS in link commands.
 magicrescue builds without dupemap on Ubuntu because the
 conftest_link() function in the configure script fails to link
 with the gdbm library, due to the position of the LDFLAGS in
 the link command. Reordering fixes the problem.
 The same fix is also required in the Makefile, otherwise the
 package will fail to build.
Author: Carlos Maddela <e7appew at gmail.com>
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 Makefile.in | 10 +++++-----
 configure   |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index ee9038f..a977a90 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -18,19 +18,19 @@ all: $(PROGRAMS) docs
 # program targets
 magicrescue: $(MAGICRESCUE_OBJS)
 dupemap: $(DUPEMAP_OBJS)
 tools/inputseek: $(INPUTSEEK_OBJS)
 tools/safecat: $(SAFECAT_OBJS)
-	$(CC) -o $@ $(LDFLAGS) $(SAFECAT_OBJS)
+	$(CC) -o $@ $(SAFECAT_OBJS) $(LDFLAGS)
 tools/textextract: $(TEXTEXTRACT_OBJS)
 # implicit targets
diff --git a/configure b/configure
index 90b2f06..a479ba1 100755
--- a/configure
+++ b/configure
@@ -63,9 +63,9 @@ EOF
 conftest_link() {
-    echo "$CC -o conftest $LDFLAGS conftest.o" >&5
+    echo "$CC -o conftest conftest.o $LDFLAGS" >&5
     echo >&5
-    $CC -o conftest $LDFLAGS conftest.o >&5 2>&5 \
+    $CC -o conftest conftest.o $LDFLAGS >&5 2>&5 \
 	&& [ -x conftest ] && ./conftest 2>&5

More information about the forensics-devel mailing list