From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EHT8AciWPWJyEAEAgWs5BA (envelope-from ) for ; Fri, 25 Mar 2022 11:17:44 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id +LfdNceWPWKTRwEAG6o9tA (envelope-from ) for ; Fri, 25 Mar 2022 11:17:43 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6FE63F2E8 for ; Fri, 25 Mar 2022 11:17:43 +0100 (CET) Received: from localhost ([::1]:45940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXh0o-0005ZO-AE for larch@yhetil.org; Fri, 25 Mar 2022 06:17:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXh0O-0005Xj-Lt for bug-guix@gnu.org; Fri, 25 Mar 2022 06:17:19 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nXh0A-0003lK-DY for bug-guix@gnu.org; Fri, 25 Mar 2022 06:17:15 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nXh0A-0002ei-9U for bug-guix@gnu.org; Fri, 25 Mar 2022 06:17:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#54557: =?UTF-8?Q?=E2=80=9Cfakechroot=E2=80=9D?= execution engine =?UTF-8?Q?doesn=E2=80=99t?= work for Bash Resent-From: Philippe SWARTVAGHER Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 25 Mar 2022 10:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54557 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 54557@debbugs.gnu.org Received: via spool by 54557-submit@debbugs.gnu.org id=B54557.164820338310150 (code B ref 54557); Fri, 25 Mar 2022 10:17:02 +0000 Received: (at 54557) by debbugs.gnu.org; 25 Mar 2022 10:16:23 +0000 Received: from localhost ([127.0.0.1]:50169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXgzW-0002dd-If for submit@debbugs.gnu.org; Fri, 25 Mar 2022 06:16:23 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:1388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXgzU-0002dN-E4 for 54557@debbugs.gnu.org; Fri, 25 Mar 2022 06:16:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=yPlWNq6M9NEgfOW8znXA75rxE+tfQg59HxR0oSK9NgA=; b=pUAx2XASFbhA76unymsbYT7AjRTkPkj18Y1QhoG/N8vJPpbQP9l5Pm5j stXFXF/HZqQuFiWOIX/fz9m9nIpL1j93OyKyqxMHcD85u8AfUjU1Yrhhe byeB/fvy2acT50S5IGfNFhpZ53AJqa/AlYwPs+ubaTQAzqWJD4KzsWqAA o=; X-IronPort-AV: E=Sophos;i="5.90,209,1643670000"; d="scan'208";a="28102104" Received: from nat-eduroam-36-gw-01-bso.bordeaux.inria.fr (HELO [10.204.6.92]) ([194.199.1.36]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2022 11:16:13 +0100 Message-ID: Date: Fri, 25 Mar 2022 11:16:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: fr References: <87sfr79i9j.fsf@inria.fr> From: Philippe SWARTVAGHER In-Reply-To: <87sfr79i9j.fsf@inria.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648203463; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=yPlWNq6M9NEgfOW8znXA75rxE+tfQg59HxR0oSK9NgA=; b=ttrVuh6xrqe/fHcc0VXm39gZoBf0ENGLDcekuzj1MUyqi0Hz+2qc06iX7OHJ8aZBBTAzo+ mPGbMPXT7XVStBBhNriOMFeM2Rif93BIlDUYvozvs4h1K67j+YWpADeywHniZU9ckVWj25 n6sm3bk1Ti+u/hsvgFDHwIIJdXlpCMFURhGdfTxfoMrsDQAmXvx9MVCjp4WT/DSFplG5nP acdOL5dyZ6JJnrFlu7oOmvC9iPeVfO/1dHCeZX0GWEfyGsY227r2TQyANctl3JBIJKGai9 d/8PB6GAq0rMpkhroJ1oPdsb9E8wkdzLtHRqu3kb222T8rBOru+vhAis49kLbg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648203463; a=rsa-sha256; cv=none; b=V6yunlLL2x0UvZG4usg57WAaEPD3W4S4d4mlABTZH00l3O9iBACmO3C4H0TV3sSgoK0Hqu cQU8q4LauCrPzTL6pRYqY91iqxZlCsjuKIVcVj0Q9xWhkyx+aCEIETcphhi+yMS+5f08uT p3pmYha4yLynjaF3gb7VCVuZaPPuCDwfC0uuo8Iz/TNm2RAs1OL+ThEZRQs4v+clvo2v4q VH9M4vYQEFuhDaGSrPHnom+Yid4N/gHTHENrVEIS03ZohuaIiKGu1LNa7z9WIqWm5yNfNt XigrM3fQ5X90P1eMQQwd204WmDYzeBvQ6htJVFRFyzGYQQXBMxozpAPEPouXWg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=inria.fr header.s=dc header.b=pUAx2XAS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=inria.fr (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.41 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=inria.fr header.s=dc header.b=pUAx2XAS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=inria.fr (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 6FE63F2E8 X-Spam-Score: 5.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: w9+SxeOH9mIZ Le 24/03/2022 à 22:02, Ludovic Courtès a écrit : > Hello! > > The “fakechroot” engine fails when applied to ‘bash’: > > --8<---------------cut here---------------start------------->8--- > $ guix pack -RR bash -S /bin=bin > /gnu/store/mnbmklbvd1pk7yby0k8h26msk6z11m1m-bash-tarball-pack.tar.gz > $ (cd /tmp/pack; tar xf /gnu/store/mnbmklbvd1pk7yby0k8h26msk6z11m1m-bash-tarball-pack.tar.gz) > $ unshare -mrf sh -c 'mount -t tmpfs -o ro none /gnu/store; GUIX_EXECUTION_ENGINE=fakechroot /tmp/pack/bin/bash --version' > /tmp/pack/gnu/store/d99ykvj3axzzidygsmdmzxah4lvxd6hw-bash-5.1.8/bin//bash: out of memory to store relocation results for /tmp/pack/bin/bash > --8<---------------cut here---------------end--------------->8--- > > The message comes from ld.so. My guess is that the problem comes from > Bash’s terrible ‘malloc’ replacement: > > --8<---------------cut here---------------start------------->8--- > $ objdump -T /gnu/store/d99ykvj3axzzidygsmdmzxah4lvxd6hw-bash-5.1.8/bin/bash | grep malloc > 00000000004ae6f0 g DF .text 000000000000003b Base malloc_usable_size > 00000000004ae850 g DF .text 0000000000000009 Base malloc > 0000000000484e70 g DF .text 000000000000005b Base xmalloc > 00000000004ee020 g DO .bss 0000000000000004 Base malloc_trace_at_exit > 00000000004e8c24 g DO .data 0000000000000004 Base malloc_mmap_threshold > 0000000000484f70 g DF .text 00000000000000dd Base sh_xmalloc > 00000000004f7a04 g DO .bss 0000000000000004 Base malloc_trace > 00000000004f7a08 g DO .bss 0000000000000004 Base malloc_flags > 00000000004ae730 g DF .text 0000000000000005 Base sh_malloc > 00000000004f7a00 g DO .bss 0000000000000004 Base malloc_register > 00000000004ae660 g DF .text 000000000000000c Base _malloc_unblock_signals > 00000000004ae630 g DF .text 000000000000002e Base _malloc_block_signals > --8<---------------cut here---------------end--------------->8--- > > [Time passes…] I confirmed this hypothesis by running: > > guix pack -RR -S /bin=bin -m manifest.scm > > on this manifest: > > --8<---------------cut here---------------start------------->8--- > (use-modules (guix) (guix utils) > (guix profiles) > (gnu packages bash)) > > (define bash-sans-malloc > (package/inherit bash > (name "bash-sans-malloc") > (arguments > (substitute-keyword-arguments (package-arguments bash) > ((#:configure-flags flags ''()) > `(cons "--without-bash-malloc" ,flags)))))) > > (packages->manifest (list bash-sans-malloc)) > --8<---------------cut here---------------end--------------->8--- > > Works just fine: > > --8<---------------cut here---------------start------------->8--- > $ unshare -mrf sh -c 'mount -t tmpfs -o ro none /gnu/store; GUIX_EXECUTION_ENGINE=fakechroot /tmp/pack/bin/bash --version' > GNU bash, version 5.1.8(1)-release (x86_64-unknown-linux-gnu) > Copyright (C) 2020 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > > This is free software; you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > --8<---------------cut here---------------end--------------->8--- > > So in the end, it’s a bug report that’s kinda closed already. > > Perhaps we should build Bash ‘--without-bash-malloc’ unconditionally in > ‘core-updates’? The ‘INSTALL’ file reads: > > --8<---------------cut here---------------start------------->8--- > '--with-bash-malloc' > Use the Bash version of 'malloc' in the directory 'lib/malloc'. > This is not the same 'malloc' that appears in GNU libc, but an > older version originally derived from the 4.2 BSD 'malloc'. This > 'malloc' is very fast, but wastes some space on each allocation. > This option is enabled by default. The 'NOTES' file contains a > list of systems for which this should be turned off, and > 'configure' disables this option automatically for a number of > systems. > --8<---------------cut here---------------end--------------->8--- > > There might be other options if we want to keep it, such as changing the > ELF visibility of those symbols, but I wonder if it’s worth the effort. > > Thoughts? > > Ludo’. Hello, FTR, the --without-bash-malloc is used in the Debian bash package: apt source bash cd bash-5.1/debian grep -Irn without-bash-malloc changelog:145:  * Configure the normal build --without-bash-malloc as well. changelog:1125:  * Configure the static build --without-bash-malloc. changelog:1462:  * Disable the GNU/kFreeBSD kludge (--without-bash-malloc). Closes: #234137. changelog:1546:  * Configure --without-bash-malloc on GNU/FreeBSD (closes: #194182). changelog:1739:  * Configure --without-bash-malloc. At least on hppa, this fixes an error, rules:79:    --without-bash-malloc This option is also advised in Linux From Scratch: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/bash.html -- Philippe