On 6/15/22 15:11, Peter Kjellerstedt wrote:
-----Original Message-----
From: [email protected] <openembedded-
[email protected]> On Behalf Of Ross Burton
Sent: den 15 juni 2022 12:52
To: [email protected]
Cc: [email protected]
Subject: Re: [OE-core] [PATCH v5 6/7] utils: Add cmdline_shebang_wrapper
util.

On 14 Jun 2022, at 16:11, Paulo Neves via lists.openembedded.org
<[email protected]> wrote:
+create_cmdline_shebang_wrapper () {
The indentation in this function is a mix of tabs and spaces, please
unify.

+  argument="$(basename "$(head -n1 $cmd | sed -e 's|#![ ]*||g' )”)”
[ ]* seems overly, complex, no need for the brackets. I’d anchor to the
beginning of the line, and remove the g as there’s only one expected.
This should work:

argument=$(basename "$(sed -ne 's/^#! *//p;q')" $cmd)

However, if the first line is something like "#!/usr/bin/env python3", then
$argument will be "env python3" and somehow I assume that is not exactly
what the rest of the code expects.

The use case is that whatever is in shebang should be extracted and ran verbatim, so truncating like your suggestion can work but has slightly different semantic.
Might also be wise to assert that you found something here, so running
this on an ELF fails with an obvious error.

Ross
//Peter

Paulo Neves
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#166988): 
https://lists.openembedded.org/g/openembedded-core/message/166988
Mute This Topic: https://lists.openembedded.org/mt/91751270/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to