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

Bug#636495: initramfs-tools: installs optimized libraries into the initramfs



On 2011-08-03 14:16 +0200, Sven Joachim wrote:

> My initramfs contains a libc6 that is optimized for i686:
>
> ,----
> | $ lsinitramfs /boot/initrd.img-$(uname -r) | grep libc.so.6                                   
> | lib/i386-linux-gnu/i686/cmov/libc.so.6
> `----
>
> No big deal for me, but wheezy/sid systems with a pre-686 processor will
> likely have a totally broken initramfs if libc6-i686 gets installed
> accidentally.
>
> This happens because the code in copy_exec() that finds the path to the
> unoptimized library assumes that these libraries reside directly in
> {/usr,}/lib and does not handle the multiarch path case.

Attached is a patch against git master that works for me:

,----
| % lsinitramfs /boot/initrd.img-$(uname -r) | grep libc.so.6
| lib/i386-linux-gnu/libc.so.6
`----

Cheers,
       Sven

>From 4548e964f26e7ed11ddf02c5e81bed4f43e8b5b0 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenjoac@gmx.de>
Date: Fri, 5 Aug 2011 13:18:49 +0200
Subject: [PATCH] copy_exec: Handle optimized libraries under multiarch paths

In a multiarch world, libraries are not directly installed under
{/usr,}/lib, but one directory below.  Adjust the search accordingly.

Closes: #636495
---
 hook-functions |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hook-functions b/hook-functions
index 41db112..dda441a 100644
--- a/hook-functions
+++ b/hook-functions
@@ -130,7 +130,7 @@ copy_exec() {
 		# Try to use non-optimised libraries where possible.
 		# We assume that all HWCAP libraries will be in tls,
 		# sse2, vfp or neon.
-		nonoptlib=$(echo "${x}" | sed -e 's#/lib/\(tls\|i686\|sse2\|neon\|vfp\).*/\(lib.*\)#/lib/\2#')
+		nonoptlib=$(echo "${x}" | sed -e 's#/lib/\([^/]*/\)\?\(tls\|i686\|sse2\|neon\|vfp\).*/\(lib.*\)#/lib/\1\3#')
 
 		if [ -e "${nonoptlib}" ]; then
 			x="${nonoptlib}"
-- 
1.7.5.4


Reply to: