Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] lib/package: cleanup objdump invocation when scanning for library dependencies
@ 2024-10-29 16:15 Ross Burton
  2024-10-30  9:38 ` [OE-core] " Mathieu Dubois-Briand
  0 siblings, 1 reply; 3+ messages in thread
From: Ross Burton @ 2024-10-29 16:15 UTC (permalink / raw)
  To: openembedded-core

Instead of using os.popen() directly, and passing a string then having
to quote the arguments, use subprocess.run() and pass a list of arguments.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oe/package.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 16359232ecd..f935b684de0 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -1625,11 +1625,11 @@ def process_shlibs(pkgfiles, d):
         sonames = set()
         renames = []
         ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
-        cmd = d.getVar('OBJDUMP') + " -p " + shlex.quote(file) + " 2>/dev/null"
-        fd = os.popen(cmd)
-        lines = fd.readlines()
-        fd.close()
         rpath = tuple()
+        cmd = [d.getVar("OBJDUMP"), "-p", file]
+        proc = subprocess.run(cmd, capture_output=True, text=True)
+        # Ignore errors silently as not all matching files will be parsed successfully
+        lines = proc.stdout.splitlines()
         for l in lines:
             m = re.match(r"\s+RPATH\s+([^\s]*)", l)
             if m:
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] lib/package: cleanup objdump invocation when scanning for library dependencies
  2024-10-29 16:15 [PATCH] lib/package: cleanup objdump invocation when scanning for library dependencies Ross Burton
@ 2024-10-30  9:38 ` Mathieu Dubois-Briand
  2024-10-31 12:47   ` Ross Burton
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Dubois-Briand @ 2024-10-30  9:38 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-core

On Tue, Oct 29, 2024 at 04:15:48PM +0000, Ross Burton wrote:
> Instead of using os.popen() directly, and passing a string then having
> to quote the arguments, use subprocess.run() and pass a list of arguments.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---

Hi Ross,

It seems this breaks a lot of things on the autobuilder, I get lot of
fails like:
FileNotFoundError: [Errno 2] No such file or directory:
'x86_64-poky-linux-objdump'

https://valkyrie.yoctoproject.org/#/builders/78/builds/347/steps/13/logs/stdio
https://valkyrie.yoctoproject.org/#/builders/50/builds/366/steps/11/logs/stdio
https://valkyrie.yoctoproject.org/#/builders/64/builds/306/steps/12/logs/stdio

Can you have a look please ?

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] lib/package: cleanup objdump invocation when scanning for library dependencies
  2024-10-30  9:38 ` [OE-core] " Mathieu Dubois-Briand
@ 2024-10-31 12:47   ` Ross Burton
  0 siblings, 0 replies; 3+ messages in thread
From: Ross Burton @ 2024-10-31 12:47 UTC (permalink / raw)
  To: Mathieu Dubois-Briand; +Cc: openembedded-core@lists.openembedded.org

On 30 Oct 2024, at 09:38, Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> wrote:
> 
> On Tue, Oct 29, 2024 at 04:15:48PM +0000, Ross Burton wrote:
>> Instead of using os.popen() directly, and passing a string then having
>> to quote the arguments, use subprocess.run() and pass a list of arguments.
>> 
>> Signed-off-by: Ross Burton <ross.burton@arm.com>
>> ---
> 
> Hi Ross,
> 
> It seems this breaks a lot of things on the autobuilder, I get lot of
> fails like:
> FileNotFoundError: [Errno 2] No such file or directory:
> 'x86_64-poky-linux-objdump’

This is fun: the old code silently ignored the case when it was meant to be running objdump on binaries but objdump is not in the sysroot. For example, qemuwrapper has INHIBIT_DEFAULT_DEPS so no binutils, but the packaging code tries to run objcopy on everything executable still.

I’ll add more error handling paths.

Ross

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-31 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29 16:15 [PATCH] lib/package: cleanup objdump invocation when scanning for library dependencies Ross Burton
2024-10-30  9:38 ` [OE-core] " Mathieu Dubois-Briand
2024-10-31 12:47   ` Ross Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox