public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com>,
	openembedded-core@lists.openembedded.org
Cc: rwmacleod@gmail.com, umesh.kalappa0@gmail.com,
	pgowda.cve@gmail.com, shivams@gmail.com
Subject: Re: [OE-core] [PATCH] rust-cross-canadian: Fix for the linker issues caused by using the shell
Date: Sun, 04 Sep 2022 23:01:21 +0100	[thread overview]
Message-ID: <a4f110ea41a9653e8fe894fabc7bf5a180bca30f.camel@linuxfoundation.org> (raw)
In-Reply-To: <1711C5DF821D6301.14041@lists.openembedded.org>

On Sun, 2022-09-04 at 22:34 +0100, Richard Purdie via
lists.openembedded.org wrote:
> On Sun, 2022-09-04 at 23:39 +0530, Sundeep KOKKONDA wrote:
> > [Yocto #14892]
> > This is a fix for YOCTO #14878 patch. When sheband is more than 128 characters the default shell /bin/sh is used to execute the linker instead of SDK shell, which causes problems with LD_LIBRARY_PATH.
> > With this patch shell usage is avoided.
> > 
> > Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com>
> > ---
> >  .../rust/files/target-rust-ccld.c             | 39 +++++++++++++++++++
> >  .../rust/rust-cross-canadian.inc              | 11 +++---
> >  2 files changed, 44 insertions(+), 6 deletions(-)
> >  create mode 100644 meta/recipes-devtools/rust/files/target-rust-ccld.c
> > 
> > diff --git a/meta/recipes-devtools/rust/files/target-rust-ccld.c b/meta/recipes-devtools/rust/files/target-rust-ccld.c
> > new file mode 100644
> > index 0000000000..13f06b38f8
> > --- /dev/null
> > +++ b/meta/recipes-devtools/rust/files/target-rust-ccld.c
> > @@ -0,0 +1,39 @@
> > +/*
> > +*
> > +* Copyright (C) 2022      Wind River Systems
> > +*
> > +* SPDX-License-Identifier: GPL-2.0-only
> > +*
> > +*/
> > +
> > +#include <string.h>
> > +#include <stdlib.h>
> > +#include <unistd.h>
> > +
> > +int main (int argc, char *argv[])
> > +{
> > +        int i=0;
> > +        char cc[1024];
> > +        char *cmd[1024];
> > +        char *ccargs[2][1024];
> 
> I'm a bit concerned about the fixed lengths coded here. What if there
> are more than 2 arguments in CC/LD? What if one of the arguments (or
> the variable) is longer than 1024?
> 
> > +
> > +        strcpy(cc,getenv("LD"));
> 
> The original code this replaces uses CC?
> 
> 
> > +        char * pch;
> > +        pch = strtok (cc," ");
> > +        while (pch != NULL)
> > +        {
> > +                strcpy(ccargs+i,pch);
> > +                printf ("%s\n",ccargs+i);
> > +                pch = strtok (NULL, " ");
> > +                i++;
> > +        }
> > +
> > +        strcpy(cmd,ccargs+0);
> > +
> > +        unsetenv("LD_LIBRARY_PATH");
> > +        execv(cmd,argv);
> > +
> 
> Where is ccargs used here (other than the first entry)?

This was getting over complicated. I'm going to try a different version
of this in master-next which calls the shell wrapper from a C program
which just unsets LD_LIBRARY_PATH. See master-next.

Cheers,

Richard



  parent reply	other threads:[~2022-09-04 22:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-04 18:09 [PATCH] rust-cross-canadian: Fix for the linker issues caused by using the shell Sundeep KOKKONDA
2022-09-04 18:12 ` Sundeep KOKKONDA
2022-09-04 21:34 ` [OE-core] " Richard Purdie
     [not found] ` <1711C5DF821D6301.14041@lists.openembedded.org>
2022-09-04 22:01   ` Richard Purdie [this message]
2022-09-05  7:12     ` Sundeep KOKKONDA
2022-09-05 11:53       ` [OE-core] " Richard Purdie
2022-09-06 12:21         ` Randy MacLeod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a4f110ea41a9653e8fe894fabc7bf5a180bca30f.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pgowda.cve@gmail.com \
    --cc=rwmacleod@gmail.com \
    --cc=shivams@gmail.com \
    --cc=sundeep.kokkonda@gmail.com \
    --cc=umesh.kalappa0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox