[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ast-users
Subject:    [ast-users] ksh version ABIJM 93v-2014-06-25 segfault
From:       "j. van den hoff" <veedeehjay () googlemail ! com>
Date:       2015-04-10 15:47:08
Message-ID: op.xwvvguebp7eajd () muck ! fritz ! box
[Download RAW message or body]

hello,

the following code consistently produces a segfault in ksh version ABIJM  
93v-2014-06-25 (but not in ksh 93u+ nor in bash or zsh):

8<---------------------------------
function f1 {
    a=$(f2)
}

function f2 {
    function f3 {
       echo inside f3
    }
    f3
}

f1
echo $a
f1  #this causes the segfault
echo $a
8<---------------------------------

i.e.the second call to `f1' triggers the segfault.

two observations:

1.
if `a=$(f2)' is replaced by directly calling `f2' in the definition of  
`f1' the segfault goes away, i.e. the problem is related
to the call happening in a subshell.

2.
if the definition of `f3' is pulled out of `f2' the segfault also goes away

I am aware that `f3' is not really nested (a local function of `f2') if  
its definition is put within `f2' but that it rather resides in the same  
global namespace as the other ones.

but in my real use case `f2' would always be called as part of command  
substitution and everything defined during execution of `f2' (including  
`f3') would thus never become user visible at the command prompt if the  
corresponding script is sourced (which is want I want to achieve). simply  
pulling the `f3' definition out of `f2' would however imply that `f3'  
becomes user visible. so there really is an incentive for having the  
definition of `f3' within that of `f2' (for me, at least).

question 1: I trust it is allowed syntax to nest function definitions?

question 2: can someone confirm the described behaviour (in my case  
observed in a current opensuse-linux (within virtualbox under macosx))?

question 3: am I right that this is a bug of ksh 93v- and if so is there a  
chance of seeing it fixed any time soon?

thanks

joerg

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic