From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id IL7gHYkk2mMDAgEAbAwnHQ (envelope-from ) for ; Wed, 01 Feb 2023 09:36:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id MP3cHYkk2mNKuwAA9RJhRA (envelope-from ) for ; Wed, 01 Feb 2023 09:36:25 +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 4CF69364DB for ; Wed, 1 Feb 2023 09:36:25 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pN8bC-0005lY-JH; Wed, 01 Feb 2023 03:36:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pN8bA-0005km-7o for bug-guix@gnu.org; Wed, 01 Feb 2023 03:36:09 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pN8b4-0001g0-6S for bug-guix@gnu.org; Wed, 01 Feb 2023 03:36:07 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pN8b3-00028V-NW for bug-guix@gnu.org; Wed, 01 Feb 2023 03:36:01 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#61055: file-needed/recurive does not canonicalize paths Resent-From: Lars-Dominik Braun Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 01 Feb 2023 08:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61055 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 61055@debbugs.gnu.org Received: via spool by 61055-submit@debbugs.gnu.org id=B61055.16752405388179 (code B ref 61055); Wed, 01 Feb 2023 08:36:01 +0000 Received: (at 61055) by debbugs.gnu.org; 1 Feb 2023 08:35:38 +0000 Received: from localhost ([127.0.0.1]:56322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pN8af-00027q-3b for submit@debbugs.gnu.org; Wed, 01 Feb 2023 03:35:38 -0500 Received: from mout-p-101.mailbox.org ([80.241.56.151]:36406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pN8aZ-00027Z-Rz for 61055@debbugs.gnu.org; Wed, 01 Feb 2023 03:35:35 -0500 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4P6Fbv3VlWz9sTn; Wed, 1 Feb 2023 09:35:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6xq.net; s=MBO0001; t=1675240523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yIpHIwS6/4nJIfkd7zmWaiujQxtA1NQcb0J1/6znUKM=; b=IEUnlrxkZiIB9n6+niSdakEkbURPIPZiXuElwKJDUHKgRW8/ib8TlbEAAbyL72drE+YT/V oDgi2gBYwTwotz0JJs59WHvrYhPIQkqgX1iBVql7BJCY7yUI5E3qH+lz+Bzxr3xhHrsqaX 8RzIQfZcQbskFvQmjagvryWJFG1sLTJmqiFO3GVQiLqmEUrUZ5y8Jo9QKV1SXq97m657UD YlAaQCHelxsVZ/zNu6Q5QtUMHKGxrtQAwnxUeAEPqt/9afOCgAsWl2hkftxi1TebBvae+I qGDA78AKH0t6OCz8wLZVsmgF8eOjcYylHZUVo6+OWgB+5sOjTwRIalCF9rEPYA== Date: Wed, 1 Feb 2023 09:35:21 +0100 From: Lars-Dominik Braun Message-ID: References: <87ilgoyoei.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87ilgoyoei.fsf@gnu.org> X-Rspamd-Queue-Id: 4P6Fbv3VlWz9sTn 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675240585; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=yIpHIwS6/4nJIfkd7zmWaiujQxtA1NQcb0J1/6znUKM=; b=Tv8FIFOXuYAVhycYo++o2Fau6JpGkevCXAjeBghnJHgWaWPQGGkzk04StPXJ9MCnTTSz4x GAgSMVanpGY35AwwKjAApAlBLJyhlK+/5iwBfbzHm4tiwVEirdt3Ir5PpNsGzgMCgY97gI IroRXf7W+K3CCs+71E1jhbaYnbL1JDVJMIAe3mlbkHDgMxIvgSkXM57mnDDpYRNv2YTyoN 1dnKjq7cqPA7K/u3aVjPmRR4sDmA9fs4k5zIkyrurtVnJtsopER+8AMc2FyDRSX8vPvIv2 NwU47whHHVJs5bALkTvRW600gTzymKijsIM9Prm0nUOZNoiH/tW+jTNsImmS2w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=IEUnlrxk; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675240585; a=rsa-sha256; cv=none; b=Dz6t2Yse0k1ND6Kpbi7Ra9xjRA36pRCIrNUe5ku0sBSj/ZLYjRUrK2wradZzIzMJIKEm8R VhhfAWop/GAXB/ioKo9hVlNKFtnpnJbAH7MdIIreyhFEjHoENSdRkuBxjPrc/c/UZ8uWen Y3AZxnZSmveFqtLfgsrbo7CuxXLaLSmsXnxY7DqbKmXMpdQND3rn/sV77DvFXXtpAM04tA bzu1jCNCnm2rgrxd9/eGXJl/0wRkTo7vu27pD7DSQ05ouk8AUF/AtVcgNGkhid5+QeVmyD r02m8b/5f8BZfQNHDKWECV+Hna33X5hKzq9LyM8Al82LcF86nDUfypoXW80H1g== Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=IEUnlrxk; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=none) X-Migadu-Scanner: scn0.migadu.com X-Spam-Score: -1.38 X-Migadu-Queue-Id: 4CF69364DB X-Migadu-Spam-Score: -1.38 X-TUID: hklWumJLp+db Hi Ludo, > Can you see how we end up with those entries? These at DT_NEEDED > entries, not DT_RUNPATH, right? they definitely do not come from the hindent binary. `readelf -d` looks like this ---snip--- 0x0000000000000001 (NEEDED) Shared library: [libHSpath-io-1.7.0-Y7nuUr9RcCC0rgElOk2Zd-ghc9.2.5.so] 0x0000000000000001 (NEEDED) Shared library: [libHSunix-compat-0.5.4-2Fa5hW7FPv81iCQxP5gtt5-ghc9.2.5.so] 0x0000000000000001 (NEEDED) Shared library: [libHStemporary-1.3-K9lHfUrZ43CE7BhnE8cSVB-ghc9.2.5.so] … 0x000000000000001d (RUNPATH) Library runpath: [/gnu/store/2nrzbaxmqs2rq9yv52bpyn2azb3qj6h1-ghc-hindent-5.3.4/lib/x86_64-linux-ghc-9.2.5:/gnu/store/1cyk8j2nd6r0cvm6kx1408kd763yf8h5-ghc-9.2.5/lib/ghc-9.2.5/Cabal-3.6.3.0:/gnu/store/lk1mgbds7rf9ilv425msz840ky8cfn79-ghc-diff-0.4.1/lib/x86_64-linux-ghc-9.2.5:/gnu/store/866s8qcghallds7azzcx075a06mr64h4-ghc-hunit-1.6.2.0/lib/x86_64-linux-ghc-9.2.5:/gnu/store/rgm9h2a4v1zgwm1mbfb36ycjbkywlxj6-ghc-onetuple-0.3.1/lib/x86_64-linux-ghc-9.2.5:… ---snap--- and I believe GHC adds `-L/gnu/store/…` and `-lHSXXX` to the linker invokation only, which should be correct. However GHC’s bundled libraries are linked differently and result in a `readelf -d /gnu/store/1cyk8j2nd6r0cvm6kx1408kd763yf8h5-ghc-9.2.5/lib/ghc-9.2.5/Cabal-3.6.3.0/libHSCabal-3.6.3.0-ghc9.2.5.so` like this: ---snip--- 0x0000000000000001 (NEEDED) Shared library: [libHSprocess-1.6.16.0-ghc9.2.5.so] 0x0000000000000001 (NEEDED) Shared library: [libHSparsec-3.1.15.0-ghc9.2.5.so] 0x0000000000000001 (NEEDED) Shared library: [libHStext-1.2.5.0-ghc9.2.5.so] … 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../process-1.6.16.0:$ORIGIN/../parsec-3.1.15.0:$ORIGIN/../text-1.2.5.0:$ORIGIN/../mtl-2.2.2:$ORIGIN/../transformers-0.5.6.2:$ORIGIN/../directory-1.3.6.2:$ORIGIN/../unix-2.7.2.2:$ORIGIN/../time-1.11.1.1:$ORIGIN/../filepath-1.4.2.2:$ORIGIN/../binary-0.8.9.0:$ORIGIN/../containers-0.6.5.1:$ORIGIN/../bytestring-0.11.3.1:$ORIGIN/../template-haskell-2.18.0.0:$ORIGIN/../pretty-1.1.3.6:$ORIGIN/../ghc-boot-th-9.2.5:$ORIGIN/../deepseq-1.4.6.1:$ORIGIN/../array-0.5.4.0:$ORIGIN/../base-4.16.4.0:$ORIGIN/../ghc-bignum-1.2:$ORIGIN/../ghc-prim-0.8.0:$ORIGIN/../rts:/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib:/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib:/gnu/store/fwbiihd2sbhai63y1pvvdh0f2bakfzrf-gmp-6.2.1/lib:/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../..] ---snap--- These obviously will get expanded to /gnu/store/1cyk8j2nd6r0cvm6kx1408kd763yf8h5-ghc-9.2.5/lib/ghc-9.2.5/Cabal-3.6.3.0/../process-1.6.16.0 And there’s about 40 of these bundled libraries referencing each other, which is why the problem is amplified. I still believe this is a bug in file-needed/recursive, because it recurses, but does not correctly keep track of “visited” shared libraries (by not canonicalizing paths). Its documentation also says that it returns a “list of absolute .so file names” – which I would expect not to have relative path elements in. The output of `ldd` does so too. So yes, canonicalize-path may be expensive, but evaluating 10000 shared libraries is too. Cheers, Lars PS: This is not a problem for wip-haskell any more, since I switched to static linking, but it’s going to bite someone else.