bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read-only flag is lost for functions in sub shells


From: Linda Walsh
Subject: Re: read-only flag is lost for functions in sub shells
Date: Thu, 31 Jul 2014 16:45:20 -0700
User-agent: Thunderbird



Greg Wooledge wrote:
On Thu, Jul 31, 2014 at 07:51:01AM -0700, Linda Walsh wrote:
Chet Ramey wrote:
$ ./bash ./x24
4.2.47(4)-release
foo = one
foo = two
$ cat ./x24
echo $BASH_VERSION

foo=one
readonly foo
export foo

./bash -c 'echo foo = $foo ; foo=two ; echo foo = $foo'
When did that change?

You might be confusing subshells with explicit new process creation.
----
        I think you are right.

        I'm having odd symptoms right now.... not sure
what changed, but my .bashrc file and .bash_env files are not longer
read on login.  Stuff done by them used to be done...but now is not.
(i.e. either something else provided the same function calls or something
called them).

Also noticing broken-ness upon using "sudo" -- functions defined
at login are undefined:

typeset -f|grep titlebar
titlebar ()
declare -fx titlebar

----side note
(I think the above is why I thought it was sent to children -- thought the
declare was in my environment)

i.e. if I type:
typeset -p, I see vars that are "read-only"
with a "declare -rx", like:

declare -rx foo="37"

I think I thought that was passed through the environment, as I
have stored such declares in a var for later execution:

i.e.
echo $_GPSAFE_
declare -Ax _GROUPS_='([atusers]="238" [tty]="5" [mediatomb]="244" [Juno]="231" [scan]="232"
.....
[trusted]="42" [lawgroup]="201" ["Group Policy Creator Owners"]="520" [docker]="499" [powerd]="204" [lock]="54" [audio]="17" )'
----


I store the declare statement for my $_GROUPS_ array  as a string, so I can
recreate it by eval'ing the string, and though bash did that for r/o vars...
my bad...
---/endside note/---

Also noticing broken-ness upon using "sudo" -- functions defined
at login are undefined:

typeset -f|grep titlebar
titlebar ()
declare -fx titlebar

/> sudo
bash: titlebar: command not found
Ishtar:/>
^^^ prompt doesn't change to "#" nor to "red" ... as used to.

Either sudo has always stripped out functions (it isn't
stripping my environment other than functions), and something
else something else redefined them, OR sudo changed.

Hmmm.....I think I installed a package for bash completions
yesturday... maybe that mucked things up...

Sorry for the various line noise... but this is sorta confusing...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]