Hi!
----
I'm not sure whether the following is a bug in ksh93 or not: Olga said
it is a bug but I think the current ksh93 behaviour may be correct:
Exporting a function-local variable causes it to be missing in the
exported environment if a function called by this function runs an
exterrnal command.
A testcase looks like this:
-- snip --
# bash4.0: function-local variable exported
$ bash -c 'function y { ksh -c "print \$ex" ; } ; function x { typeset
-x ex ; for ex in "foo" "bar" ; do export ex ; y ; done ; } ; x'
foo
bar
# Solaris ksh88: function-local variable exported
$ ksh -c 'function y { ksh -c "print \$ex" ; } ; function x { typeset
-x ex ; for ex in "foo" "bar" ; do export ex ; y ; done ; } ; x'
foo
bar
# ksh93: function-local variable _not_ exported
$ ksh93 -c 'function y { ksh -c "print \$ex" ; } ; function x {
typeset -x ex ; for ex in "foo" "bar" ; do export ex ; y ; done ; } ;
x'
-- snip --
AFAIK the shell should allow function-local variables to be exported
(e.g. that they show-up in the environment variable list of commands
run by this function) but be removed from the export list if the
function exits (and therefore the variable disappears). This happens
correctly for bash4.0, ksh88 and ksh93.
The question is now whether the variable should still be exported to
the environment of external commands if the function calls another
function, therefore making the function-local variable "invisible" to
the current function. bash4.0 and ksh88 still keep the function-local
visible in the exported environment in the called function while ksh93
removes it from the exported list if the function-local variable
becomes "invisible".
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) [email protected]
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users