From nobody Wed Mar 8 00:04:22 2023 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PWXcH0JwRz3wqL6; Wed, 8 Mar 2023 00:04:31 +0000 (UTC) (envelope-from list_freebsd@bluerosetech.com) Received: from echo.brtsvcs.net (echo.brtsvcs.net [208.111.40.118]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PWXcG5GwGz4HLx; Wed, 8 Mar 2023 00:04:30 +0000 (UTC) (envelope-from list_freebsd@bluerosetech.com) Authentication-Results: mx1.freebsd.org; none Received: from chombo.houseloki.net (65-100-43-2.dia.static.qwest.net [65.100.43.2]) by echo.brtsvcs.net (Postfix) with ESMTPS id 9B01E38D09; Wed, 8 Mar 2023 00:04:22 +0000 (UTC) Received: from [10.26.25.100] (ivy.pas.ds.pilgrimaccounting.com [10.26.25.100]) by chombo.houseloki.net (Postfix) with ESMTPSA id 4DB97287AD; Tue, 7 Mar 2023 16:04:22 -0800 (PST) Subject: Re: How do I determine the ABI string used by pkg? To: Dan Langille Cc: ports@freebsd.org, questions@freebsd.org References: <32d2e376-3f89-0588-316d-801d4cbf0b44@bluerosetech.com> <20230306075622.xfzs33fmflc2vmtb@aniel.nours.eu> <257260d9-1812-3ce5-5d9a-907e2b1ec13e@langille.org> From: Mel Pilgrim Message-ID: Date: Tue, 7 Mar 2023 16:04:22 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 In-Reply-To: <257260d9-1812-3ce5-5d9a-907e2b1ec13e@langille.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4PWXcG5GwGz4HLx X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:36236, ipnet:208.111.40.0/24, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On 2023-03-07 9:09, Dan Langille wrote: > Baptiste Daroussin wrote on 3/6/23 2:56 AM: >> On Wed, Mar 01, 2023 at 11:50:13PM -0800, Mel Pilgrim wrote: >>> I need to determine the ABI string pkg uses on a given system, and need to >>> do so when there are no pkgs installed. >> pkg config ABI >> pkg config ALTABI > > When run in a freshly-created jail: > > [r730-01 dvl ~] % sudo jexec empty_tester > root@:/ # pkg config ABI > FreeBSD:13:amd64 > root@:/ # pkg config ALTABI > freebsd:13:x86:64 > root@:/ # > > Mel: I think this is what you wanted to get? Your freshly-created jail has pkg installed. `pkg config ABI` only works if pkg has been bootstrapped. Getting the ABI string with just the /usr/sbin/pkg stub available is another thing entirely, even though that stub program necessarily has the code to determine the ABI string. I ended up writing a small program that replicates the ELF-divining logic in pkg and prints the value of ABI. IMO the stub should have the `pkg config ABI` functionality added to it, but I'm probably alone in thinking that would be useful.