From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF912A0543; Wed, 12 Oct 2022 17:16:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A06EA430B2; Wed, 12 Oct 2022 17:16:59 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id 6DEC8430A9 for ; Wed, 12 Oct 2022 17:16:58 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id l16-20020a05600c4f1000b003c6c0d2a445so1430418wmq.4 for ; Wed, 12 Oct 2022 08:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=h6p+383cEz4gmS7YldtypJMcQ8NnREmV1S0A1IYtk8Y=; b=Mx0Sl/yOd7lamRV+7xtjdB1ueRBwlIx15BEUAqNOOXxR7nMouGyglqHdWJAe16gaUx bM3ZTu8fFn3kUkhLcoZ/RuW+DgYw7GHdmpQ9nGFmhDwBaGZHa2oESkYqEmrPeCUHUrCs zVGzkdHlKfU6HajViFrZMeljr/TwoueIC1ZrPyQMRQZ3rnijSpWTYAcSn1+UBhWmGEwH EHAt3uAXFO4QP3lYst8RGkKzHbPh99KQIfPZs38W7AVVu8tMzXz1iU6S3oD1BiKKek6F jGp8Ggq9ubTYL/a66ixDMwO7mlIgVmQmtgekgaRSwUjbDbEHSV92n2Ek4VSM0867vqyj k3Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=h6p+383cEz4gmS7YldtypJMcQ8NnREmV1S0A1IYtk8Y=; b=DTlOnH+8KSLCH9n1r+WZ1IsCrADGN+c3NCEVY6MCVuHppc3+yJKV2YoqYj290hV3NP Er7qF9gPcZpUPU3uOpMG8Ovid2vojzmByhHI4sSHO0j9mmOqvwvKwHBYpLLG6XiWOYzA aSOY6uRXOeLL/obwwQlKy7FXVJro/M9YlkSxV+dpl8z/slNpKltcnJGAi4UqOZlVyEZh Q9Dl9i0cZBbNvq5f9v9/IfpvUxhadSVr+vsH+NjQ2XvLZlQM4L/eZPuPXl9g8PhnhBaf gZ2Gkco/KZT15E9eVy/CS6Eo5dJ5VHTzOqfkEebwCEYaA9WoUhtIGawE6rMj4tV7lgm0 ndDw== X-Gm-Message-State: ACrzQf0Ey2cTcIn7Rxc3wEIKoeuRpa0CZ/9ypD4BI8D2pozfRqijZxrX aIHoscUbZUIqBeUjHS/vUB78I6T64FDgBA== X-Google-Smtp-Source: AMsMyM73ZigT9eb0Beopp4FctYB+jQLE9VirapegJ49OXfR46NDoXGvLsJhO04Z9zOb/maC+/ZsM1g== X-Received: by 2002:a05:600c:3515:b0:3b4:a0fa:c4e1 with SMTP id h21-20020a05600c351500b003b4a0fac4e1mr3197762wmq.191.1665587818085; Wed, 12 Oct 2022 08:16:58 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id az12-20020a05600c600c00b003a62052053csm2445107wmb.18.2022.10.12.08.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 08:16:57 -0700 (PDT) Date: Wed, 12 Oct 2022 17:16:56 +0200 From: Olivier Matz To: Thomas Monjalon Cc: Robin Jarry , dev@dpdk.org, Ferruh Yigit , Bruce Richardson Subject: Re: [PATCH v7] usertools: rewrite pmdinfo Message-ID: References: <20220913105811.84384-1-robin@jarry.cc> <20221004192909.457503-1-rjarry@redhat.com> <2415152.uoxibFcf9D@thomas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2415152.uoxibFcf9D@thomas> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi, On Tue, Oct 11, 2022 at 12:44:56AM +0200, Thomas Monjalon wrote: > 04/10/2022 21:29, Robin Jarry: > > dpdk-pmdinfo.py does not produce any parseable output. The -r/--raw flag > > merely prints multiple independent JSON lines which cannot be fed > > directly to any JSON parser. Moreover, the script complexity is rather > > high for such a simple task: extracting PMD_INFO_STRING from .rodata ELF > > sections. Rewrite it so that it can produce valid JSON. > > > > Remove the PCI database parsing for PCI-ID to Vendor-Device names > > conversion. This should be done by external scripts (if really needed). > > > > The script passes flake8, black, isort and pylint checks. > > > > I have tested this with a matrix of python/pyelftools versions: > > > > pyelftools > > 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 > > 3.6 ok ok ok ok ok ok ok ok > > 3.7 ok ok ok ok ok ok ok ok > > Python 3.8 ok ok ok ok ok ok ok ok > > 3.9 ok ok ok ok ok *ok ok ok > > 3.10 fail fail fail fail ok ok ok ok > > > > * Also tested on FreeBSD > > > > All failures with python 3.10 are related to the same issue: > > > > File "elftools/construct/lib/container.py", line 5, in > > from collections import MutableMapping > > ImportError: cannot import name 'MutableMapping' from 'collections' > > > > Python 3.10 support is only available since pyelftools 0.26. The script > > will only work with Python 3.6 and later. > > > > Update the minimal system requirements, docs and release notes. > > > > Signed-off-by: Robin Jarry > > Tested-by: Ferruh Yigit > > Tested-by: Olivier Matz > > Acked-by: Bruce Richardson > > Applied, thanks. As discussed off-list with Robin, it appears that "ldd" is not available on buildroot-based images. See: http://lists.busybox.net/pipermail/buildroot/2013-July/074927.html The link is quite old but it seems it's still true today if we don't build the toolchain. Robin suggested this patch: --- a/usertools/dpdk-pmdinfo.py +++ b/usertools/dpdk-pmdinfo.py @@ -290,8 +290,10 @@ def get_needed_libs(path: Path) -> Iterator[Path]: """ Extract the dynamic library dependencies from an ELF executable. """ + env = os.environ.copy() + env["LD_TRACE_LOADED_OBJECTS"] = "1" with subprocess.Popen( - ["ldd", str(path)], stdout=subprocess.PIPE, stderr=subprocess.PIPE + [str(path)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env ) as proc: out, err = proc.communicate() if proc.returncode != 0: One subtle difference is that the patched version won't work on non-executable files, but I don't think it can happen in real-life. An alternative for us is to provide a simple "ldd" shell script in our buildroot-based images. I don't have a strong opinion, I'll tend to say that the patch is a better option. Any comment? Thanks, Olivier