[OE-core] [PATCH] autogen: fix autoopts script generation to handle shebang

Belal, Awais Awais_Belal at mentor.com
Tue May 16 05:36:02 UTC 2017


> The standard way to fix too long #! lines in oe is to patch upstream
> code to use
> #!/usr/bin/env something
> (where something is just the binary name).

> Why not simply replace ${POSIX_SHELL} with /bin/sh? Where and how is it set?

POSIX_SHELL is being set to "/usr/bin/env sh" already through the recipe but it gets resolved/expanded to <build-dir>/hosttools/<shell-bin> during the configuration process so it's not usable for shebang in deep directory hierarchy scenarios.
I guess a better way would be simply to use the same technique that we're using for perl. So for shell we'll have

#!/usr/bin/env sh

in mk-tpl-config.sh directly. I'll submit the change as v2 if you think this is okay.

BR,
Awais

________________________________________
From: Alexander Kanavin <alexander.kanavin at linux.intel.com>
Sent: Monday, May 15, 2017 8:10 PM
To: Belal, Awais; openembedded-core at lists.openembedded.org
Subject: Re: [OE-core] [PATCH] autogen: fix autoopts script generation to handle shebang

On 05/15/2017 06:03 PM, Belal, Awais wrote:
> Hi Alex,
>
>> The first line will guarantee a short shebang, while the second one
>> may result in a very long shebang which may hit the hardcoded
>> kernel limit.
>
> I do not see how the second one can be longer in any case than the
> first one but that's probably because of my lack of knowledge. I can
> confirm that the changes around perl setting are not required and I
> only stepped over it because I was using an older commit of core
> however the change for sh is still required. Should I submit a v2
> with that change only or is there a concern around that as well?

The sh part is also using readlink, which produces full paths, and
therefore is incorrect. You simply should not use full paths in #!, as
depending on your setup they may be still too long.

The standard way to fix too long #! lines in oe is to patch upstream
code to use
#!/usr/bin/env something
(where something is just the binary name).

Why not simply replace ${POSIX_SHELL} with /bin/sh? Where and how is it set?

Alex



More information about the Openembedded-core mailing list