mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ian Abbott <abbotti@mev.co.uk>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] startup: execute /env/bin/init as part of the initial shell
Date: Thu, 13 Jun 2019 07:57:01 +0200	[thread overview]
Message-ID: <20190613055701.w4k5gnqzucms2mkh@pengutronix.de> (raw)
In-Reply-To: <20190612094333.8648-1-abbotti@mev.co.uk>

On Wed, Jun 12, 2019 at 10:43:33AM +0100, Ian Abbott wrote:
> Commit 90df2a955e3c ("defaultenv: Convert init script to C")
> unintentionally changed the way the legacy "/env/bin/init" script is
> run, so that it runs in a sub-shell context, effectively changing
> `run_command("source /env/bin/init");` to
> `run_command("/env/bin/init");`.  Therefore, any changes to shell
> environment variables made by the script are undone when the script
> exits.  This patch reverts back to the old behavior.
> 
> Fixes: 90df2a955e3c ("defaultenv: Convert init script to C")
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
>  common/startup.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/common/startup.c b/common/startup.c
> index 9fac0eabb..9345d131b 100644
> --- a/common/startup.c
> +++ b/common/startup.c
> @@ -188,11 +188,12 @@ static bool test_abort(void)
>  	return false;
>  }
>  
> +#define INITFILE "/env/bin/init"
> +
>  static int run_init(void)
>  {
>  	DIR *dir;
>  	struct dirent *d;
> -	const char *initfile = "/env/bin/init";
>  	const char *initdir = "/env/init";
>  	const char *menufile = "/env/menu/mainmenu";
>  	struct stat s;
> @@ -206,10 +207,10 @@ static int run_init(void)
>  	setenv("PATH", "/env/bin");
>  
>  	/* Run legacy /env/bin/init if it exists */
> -	env_bin_init_exists = stat(initfile, &s) == 0;
> +	env_bin_init_exists = stat(INITFILE, &s) == 0;
>  	if (env_bin_init_exists) {
> -		pr_info("running %s...\n", initfile);
> -		run_command(initfile);
> +		pr_info("running %s...\n", INITFILE);
> +		run_command("source " INITFILE);
>  		return 0;
>  	}
>  
> -- 
> 2.20.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2019-06-13  5:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12  9:43 Ian Abbott
2019-06-13  5:57 ` Sascha Hauer [this message]

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=20190613055701.w4k5gnqzucms2mkh@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=abbotti@mev.co.uk \
    --cc=barebox@lists.infradead.org \
    /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