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

2014-08-01 Thread Linda Walsh
Greg Wooledge wrote: On Thu, Jul 31, 2014 at 04:45:20PM -0700, Linda Walsh wrote: Also noticing broken-ness upon using "sudo": functions are undefined... Some implementations of sudo clear the environment before elevating privileges. Clearing the environment would also remove exported func

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

2014-08-01 Thread Greg Wooledge
On Thu, Jul 31, 2014 at 04:45:20PM -0700, Linda Walsh wrote: > Also noticing broken-ness upon using "sudo" -- functions defined > at login are undefined: > > >typeset -f|grep titlebar > titlebar () > declare -fx titlebar Some implementations of sudo clear the environment before elevating privi

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

2014-07-31 Thread Linda Walsh
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 chan

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

2014-07-31 Thread Chet Ramey
On 7/31/14, 3:36 PM, Chris F.A. Johnson wrote: > On Thu, 31 Jul 2014, Chet Ramey wrote: >> On 7/31/14, 10:51 AM, Linda Walsh wrote: > ... >>> I thought the idea of RO vars being passed to children was considered >>> desirable? >> >> As Greg says, there's no existing mechanism to do that using the >

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

2014-07-31 Thread Chris F.A. Johnson
On Thu, 31 Jul 2014, Chet Ramey wrote: On 7/31/14, 10:51 AM, Linda Walsh wrote: ... I thought the idea of RO vars being passed to children was considered desirable? As Greg says, there's no existing mechanism to do that using the environment, which is the only way to communicate across exec(2

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

2014-07-31 Thread Chet Ramey
On 7/31/14, 10:51 AM, Linda Walsh wrote: > > > Chet Ramey wrote: >> On 7/30/14, 6:11 PM, Linda Walsh wrote: >>> If I assigned the read-only bit to an exported var and run a new >>> shell, that var is still read-only. >> >> No: >> >> $ ./bash ./x24 >> 4.2.47(4)-release >> foo = one >> foo = two >>

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

2014-07-31 Thread Greg Wooledge
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' > > Whe

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

2014-07-31 Thread Linda Walsh
Chet Ramey wrote: On 7/30/14, 6:11 PM, Linda Walsh wrote: If I assigned the read-only bit to an exported var and run a new shell, that var is still read-only. No: $ ./bash ./x24 4.2.47(4)-release foo = one foo = two $ cat ./x24 echo $BASH_VERSION foo=one readonly foo export foo ./bash -c

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

2014-07-31 Thread Chet Ramey
On 7/30/14, 6:11 PM, Linda Walsh wrote: > If I assigned the read-only bit to an exported var and run a new > shell, that var is still read-only. No: $ ./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 ; f