tags 765810 + patch
thanks

Hi Mattia,

based on your suggestion to just set LD_PRELOAD to libeatmydata.so
I’ve made success today to use eatmydata in a Multi-Arch scenario,
which fixes the bzip2 example case I wrote about in the bugreport.

I’ve ingeniously added the location of the libeatmydata.so file of
the *old* eatmydata package to LD_LIBRARY_PATH, making it work for
chroots transparently as well.

Please consider the attached patch, which I can commit directly to
the collab-maint repository as well, if you want. I intend to NMU,
if you want it to be uploaded quickly please say so, as otherwise,
I’ll wait a week and upload to DELAYED.

Note that this includes your already-committed fix to the FTBFS on
other architectures, *and* another fix of mine, adding the missing
multiarch-support Pre-Depends to the library package (probably RC,
maybe not for jessie though).

Hope you like it ☺

Cc to the other maintainers/uploaders so they are informed. Please
share your thoughts on this, if you have any ☻

bye,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
From 0a1d2146ff766a7f110ba4600c08587949ba419a Mon Sep 17 00:00:00 2001
From: Thorsten Glaser <t.gla...@tarent.de>
Date: Mon, 17 Nov 2014 16:14:51 +0100
Subject: [PATCH] replace eatmydata with M-A and chroot safe version; add
 missing Pre-Depends

Signed-off-by: Thorsten Glaser <t.gla...@tarent.de>
---
 debian/changelog         | 11 +++++--
 debian/control           |  1 +
 debian/eatmydata.install |  1 -
 debian/eatmydata.sh      | 84 ++++++++++++++++++++++++++++++++++++++++++++++++
 debian/rules             |  3 ++
 5 files changed, 97 insertions(+), 3 deletions(-)
 delete mode 100644 debian/eatmydata.install
 create mode 100644 debian/eatmydata.sh

diff --git a/debian/changelog b/debian/changelog
index a72cc61..078218e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,16 @@
-libeatmydata (82-4) UNRELEASED; urgency=medium
+libeatmydata (82-3.1) unstable; urgency=medium
 
+  [ Mattia Rizzolo ]
   * [c6fde16] Fix FTBFS on hurd-i386 and kfreebsd-* due to missing strace (used
     by the test suite) (Closes: #769605).
 
- -- Mattia Rizzolo <mat...@mapreri.org>  Sat, 15 Nov 2014 21:13:48 +0100
+  [ Thorsten Glaser ]
+  * Non-maintainer upload.
+  * Add missing Pre-Depends on multiarch-support
+  * Replace eatmydata executable with one both Multi-Arch safe and
+    compatible with older eatmydata versions in chroots (Closes: #765810)
+
+ -- Thorsten Glaser <t...@mirbsd.de>  Mon, 17 Nov 2014 16:13:36 +0100
 
 libeatmydata (82-3) unstable; urgency=low
 
diff --git a/debian/control b/debian/control
index 544aea7..fad32ae 100644
--- a/debian/control
+++ b/debian/control
@@ -36,6 +36,7 @@ Description: Library and utilities designed to disable fsync and friends
 
 Package: libeatmydata1
 Architecture: any
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${misc:Depends},
          ${shlibs:Depends}
 Breaks: eatmydata (<< 82-1)
diff --git a/debian/eatmydata.install b/debian/eatmydata.install
deleted file mode 100644
index 1bcb5da..0000000
--- a/debian/eatmydata.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/bin/eatmydata
diff --git a/debian/eatmydata.sh b/debian/eatmydata.sh
new file mode 100644
index 0000000..558122b
--- /dev/null
+++ b/debian/eatmydata.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+#-
+# Copyright © 2014
+#	Thorsten “mirabilos” Glaser <t.gla...@tarent.de>
+#
+# Provided that these terms and disclaimer and all copyright notices
+# are retained or reproduced in an accompanying document, permission
+# is granted to deal in this work without restriction, including un‐
+# limited rights to use, publicly perform, distribute, sell, modify,
+# merge, give away, or sublicence.
+#
+# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
+# the utmost extent permitted by applicable law, neither express nor
+# implied; without malicious intent or gross negligence. In no event
+# may a licensor, author or contributor be held liable for indirect,
+# direct, other damage, loss, or other issues arising in any way out
+# of dealing in the work, even if advised of the possibility of such
+# damage or existence of a defect, except proven that it results out
+# of said person’s immediate fault when using the work as intended.
+#-
+# eatmydata utility / wrapper compatible with both 26 and 82 series,
+# but only on Debian systems.
+
+usage() {
+	echo >&2 "usage: $0 [--] command [arg ...]"
+	exit 2
+}
+
+# everything in a function to avoid environment pollution
+runprog() {
+	local cmd me spath saveIFS pathelem tgt
+
+	# Detect operation mode. If this script is run via a symbolic link,
+	# look for the basename in the PATH and execute that.
+	if test -L "$0"; then
+		# symlink mode
+		cmd=$(basename "$0")
+	else
+		# regular mode
+		test x"$1" = x"--" && shift
+		test -n "$1" || usage
+		cmd=$1
+		shift
+	fi
+
+	# detect command to run, if necessary
+	case $cmd in
+	(*/*) ;;
+	(*)
+		# $cmd does not contain a '/'
+		# look in the PATH but avoid loops with myself
+		me=$(readlink -f "$0")
+		# append :/dev/null both to catch a trailing colon
+		# and for an easy abort condition
+		spath=$PATH:/dev/null
+		saveIFS=$IFS
+		IFS=:
+		for pathelem in $PATH; do
+			if test x"$pathelem" = x"/dev/null"; then
+				echo >&2 E: eatmydata: \
+				    "unable to find '$cmd' in PATH"
+				exit 1
+			fi
+			tgt=${pathelem:-.}/$cmd
+			if test -x "$tgt"; then
+				tgt=$(readlink -f "$tgt")
+				test x"$tgt" = x"$me" || break
+			fi
+		done
+		IFS=$saveIFS
+		cmd=$tgt
+		;;
+	esac
+
+	# set up environment
+	LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+"$LD_LIBRARY_PATH:"}/usr/lib/libeatmydata
+	LD_PRELOAD=${LD_PRELOAD:+"$LD_PRELOAD "}libeatmydata.so
+	export LD_LIBRARY_PATH LD_PRELOAD
+
+	# execute the command
+	exec "$cmd" "$@"
+}
+
+runprog "$@"
diff --git a/debian/rules b/debian/rules
index e205654..a860f3b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,6 +7,9 @@ override_dh_installdirs:
 
 override_dh_install:
 	find $(CURDIR)/debian/tmp -name *.la -delete
+	rm -f $(CURDIR)/debian/tmp/usr/bin/eatmydata
+	install -D $(CURDIR)/debian/eatmydata.sh \
+	    $(CURDIR)/debian/eatmydata/usr/bin/eatmydata
 	dh_install --list-missing
 
 %:
-- 
2.1.3

Reply via email to