From: Ian Abbott <abbotti@mev.co.uk>
To: barebox@lists.infradead.org
Subject: Re: Environment variables set by /env/bin/init disappear when script exits
Date: Tue, 11 Jun 2019 16:21:06 +0100 [thread overview]
Message-ID: <2ed1eda2-04b8-0ddc-0be0-793aae74f57d@mev.co.uk> (raw)
In-Reply-To: <ccde5e10-c624-f8b1-93f8-48d76ff699bd@mev.co.uk>
On 11/06/2019 15:52, Ian Abbott wrote:
> Since commit 90df2a955e3c ("defaultenv: Convert init script to C"), if
> the legacy /env/bin/init script is still being used, any environment
> variables that were set in the script (such as the PS1 prompt) disappear
> when the script exits. I guess it is because the script is now run
> directly by run_command(initfile) (initfile is "/env/bin/init") rather
> than by run_command("source /env/bin/init").
This seems easy to fix in "common/startup.c", assuming it is indeed a
bug. Which of the following fixes would be preferable?
1. Call run_command with a string literal:
run_command("source /env/bin/init");
2. Call run_command with a string constant:
const char *source_initfile = "source /env/bin/init";
run_command(source_initfile);
3. Call run_command with a dynamically constructed string:
char *scr;
scr = basprintf("source %s", initfile);
run_command(scr);
free(scr);
--
-=( Ian Abbott <abbotti@mev.co.uk> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268. Registered address: )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-06-11 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 14:52 Ian Abbott
2019-06-11 15:21 ` Ian Abbott [this message]
2019-06-12 6:32 ` Sascha Hauer
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=2ed1eda2-04b8-0ddc-0be0-793aae74f57d@mev.co.uk \
--to=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