All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Richard Tollerton <rich.tollerton@ni.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH] data: Avoid attempting to assign readonly shell vars
Date: Thu, 18 Dec 2014 22:28:56 +0000	[thread overview]
Message-ID: <1418941736.13316.4.camel@linuxfoundation.org> (raw)
In-Reply-To: <87tx0su2ys.fsf@weregild.i-did-not-set--mail-host-address--so-tickle-me>

On Thu, 2014-12-18 at 14:18 -0600, Richard Tollerton wrote:
> Richard Purdie <richard.purdie@linuxfoundation.org> writes:
> > On Wed, 2014-12-17 at 19:11 -0600, Richard Tollerton wrote:
> >> The fix is to attempt to modify the variable in a subshell before doing
> >> the assignment.
> >
> > Isn't this going to involve fork() calls for every single shell
> > variable?
> 
> Yes :(
> 
> I'm not quite sure how to rigorously check the performance difference;
> is there a decent test case that exercises this and only this?
> 
> > There must be a better way to do this?
> 
> Not unless we rewrite how we set up the environment. My reading of POSIX
> is that no query facility exists for determining the read-only status of
> a variable [1] [2], and that the only permitted action for attempting to
> set a read-only variable is to exit [3] [4].
> 
> I suppose that enforcing a hard dependency on bash (via #!/usr/bin/env
> bash) could work around this, since this only seems to appear in POSIX
> mode; but I'm not yet convinced that the bash execution behavior when
> run as bash (vs sh) won't change in the future. Should I bring this up
> on bug-bash?

It might be an idea, it seems crazy that scripts can't tell if a given
action is going to result in their termination.

As for addressing the problem, from my reading of the bash environment
variables, there looks like a finite list of them which could cause
problems, so a blacklist may be an option, albeit an annoying one.

There is a correctness issue here since if we set something, we really
do want it set or an error in many cases.

Cheers,

Richard



  reply	other threads:[~2014-12-18 22:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18  1:11 [PATCH] data: Avoid attempting to assign readonly shell vars Richard Tollerton
2014-12-18  1:11 ` [PATCH] data: escape '$' in shell variable assignment Richard Tollerton
2014-12-18 10:29 ` [PATCH] data: Avoid attempting to assign readonly shell vars Richard Purdie
2014-12-18 20:18   ` Richard Tollerton
2014-12-18 22:28     ` Richard Purdie [this message]
2014-12-18 23:47       ` Richard Tollerton
2014-12-19  0:03         ` Richard Tollerton

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=1418941736.13316.4.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=rich.tollerton@ni.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.