From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=lgut.eu Authentication-Results: passt.top; dkim=pass (2048-bit key; unprotected) header.d=lgut-eu.20230601.gappssmtp.com header.i=@lgut-eu.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=qjBDgfFZ; dkim-atps=neutral Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by passt.top (Postfix) with ESMTPS id 43DD85A004C for ; Mon, 23 Sep 2024 12:09:11 +0200 (CEST) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a90188ae58eso517652866b.1 for ; Mon, 23 Sep 2024 03:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lgut-eu.20230601.gappssmtp.com; s=20230601; t=1727086151; x=1727690951; darn=passt.top; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=Cpkj0kNzce+UVyviqLvZNbCmJkYvrsg6IpGfhqg6e8o=; b=qjBDgfFZ9uvSfesJqpwH7HTPYlFhBuUoignnyd023QjPem+1F78PjrzrlmOVx3nHfB csVoejRifMv6P+fmsekeOFl4H7+Y9eEgEwGdIjkMb6RW6ErzAtG1hYWPuJZaYOuhLIaM gqR3cR06q4XDDj1BuRSryNxwsZrEdfjtvK5ha3K3seith1CRfyUsCtbKWFLGI4OpW3c/ sY3Q3/1h3dWeYpNDudBVFuKnc7ipr4CwfgZ8mnsy4xd4MICgD6ZKx43TIlPQQIuDsaZQ 5js1XalKXmwqX/M07wBG4V8M7MUl0hlORyyG5uKJA0pfagdQJuvqJjCJpC3P1npo4Xkw Goqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727086151; x=1727690951; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Cpkj0kNzce+UVyviqLvZNbCmJkYvrsg6IpGfhqg6e8o=; b=oZbiSrHLLgYFExqGcmoyxqgrN1YWT1Wb6Azf1lJh3dTLuLXTVsnInv9YFZHzQ6TRs1 4ZYZP9Tp3Jb7B9pIdVgjG28BUFOjxZhIEWLQbmSudnVII58PHMK89uccSt3hO8DjD3hn tVcnkHZsCcgGlo70zaskT6TwO6Yh/R+y4vOlwi08m+XTE9pIES25Lyt9KKv77dlqs2wd H0SSkQiMeZ+P1NVC426cRaWNRBeuez3oYpxzWmuA2PRFWRweH3RFx4pOQttrizzb/VR/ AUZxjQVgcF4z5FrOJXjCzmwaAdAp7yCYWnIqyeEjk0u2ghHwTz6XdmeIEVsi4SZ1xTuC TA5w== X-Forwarded-Encrypted: i=1; AJvYcCUtea6Z33D269miDvYkmVpkZJ/YuQUeKN9DJfmnKdeYoaGFGVvD5i4nhNqduyeLwAN+AwZlpLXZTMk=@passt.top X-Gm-Message-State: AOJu0Yz5VRPUkg6Uk38A6JJ2twuaFXsqp/B2/ld9j6p7JKyjSgFRgnw6 6l7yDaCEOlLNK77Sz5ojiXMv/mycck1RaS/ZuVMhI8fvmQ9Y0p0ay43ShiqaJ08= X-Google-Smtp-Source: AGHT+IEOO4+6+V0UHJ6lI/Mu9zhGse7d53nLrhOiFhkYY4Q1oCMIgS0Az45ORds8/G8JSefWJVqD8A== X-Received: by 2002:a17:907:3e20:b0:a86:8f8f:4761 with SMTP id a640c23a62f3a-a90d56dffb1mr1205512766b.25.1727086150681; Mon, 23 Sep 2024 03:09:10 -0700 (PDT) Received: from [192.168.1.135] (ip-046-005-003-117.um12.pools.vodafone-ip.de. [46.5.3.117]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a90612b3a0fsm1190552766b.117.2024.09.23.03.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 03:09:10 -0700 (PDT) Message-ID: Subject: Re: [PATCH v2 1/4] mbuto: Pick a src when ld reported as link by ldd From: Lukasz Gut To: David Gibson Date: Mon, 23 Sep 2024 12:09:09 +0200 In-Reply-To: References: <20240918101532.85299-1-lgut@lgut.eu> <20240918101532.85299-3-lgut@lgut.eu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.0 MIME-Version: 1.0 Message-ID-Hash: ZNV6DLY7ZKLSEVAOTOZQF3AX5M4CGFVN X-Message-ID-Hash: ZNV6DLY7ZKLSEVAOTOZQF3AX5M4CGFVN X-MailFrom: lgut@lgut.eu X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: sbrivio@redhat.com, sevinj.aghayeva@gmail.com, passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, 2024-09-23 at 13:51 +1000, David Gibson wrote: > On Wed, Sep 18, 2024 at 12:12:56PM +0200, Lukasz Gut wrote: > > On Arch Linux ldd /bin/sh reports: > > /lib64/ld-linux-x86-64.so.2 =3D> /usr/lib64/ld-linux-x86-64.so.2 > > Use a regex to pick only right side and use it for path processing. >=20 > I think this approach is overly specific. The broader point here is > that ldd can list libraries (including the dynamic linker) as either a > link, or directly as a file. In the cases Stefano wrote for, it was > always a single file for the dynamic linker and a link for everything > else. For Arch it seems to be a link for everything, but both of > those might not be true everywhere. >=20 > It would make more sense to alter the loop above which processes all > libraries to handle both the link and no-link cases, and remove the > special case handling of ld.so. That's a very good point. I have even briefly tried that before, since that should produce less code instead of more, but I've had some difficulties. I will attempt it again. >=20 > > Signed-off-by: Lukasz Gut > > --- > > mbuto | 11 ++++++++--- > > 1 file changed, 8 insertions(+), 3 deletions(-) > >=20 > > diff --git a/mbuto b/mbuto > > index b80ea78..1c3b347 100755 > > --- a/mbuto > > +++ b/mbuto > > @@ -704,9 +704,14 @@ __libs_copy() { > > for __l in $("${LDD}" "${1}" 2>/dev/null); do > > case ${__l} in "/"*" "*) __ld_so=3D"${__l% *}" ;; *) ;; esac > > done > > - if [ -n "${__ld_so}" ]; then > > - libs_copy_ld_so "${__ld_so}" > > - libs_path_add "${__ld_so##${wd}}" > > + # On Arch Linux ld is reported by ldd in form: > > + # /lib64/ld-linux-x86-64.so.2 =3D> /usr/lib64/ld-linux-x86-64.so.2 > > + # Make sure to take only right part in this case. > > + __ld_path=3D"${__ld_so##*=3D> }" > > + > > + if [ -n "${__ld_path}" ]; then > > + libs_copy_ld_so "${__ld_path}" > > + libs_path_add "${__ld_path##${wd}}" > > fi > > } > > =20 >=20 -- Lukasz