'typeset -p' segfaults after failing to redefine a type variable in a namespace
dnewhall opened this issue · comments
If this code is run in 1.0.10:
namespace foo {
typeset -T Foo_t=(
typeset name=
)
}
And then you do a typeset -p | head -1
, everything works fine.
If the first code is run again, it outputs the usual message about not being able to redefine types.
However, then doing a typeset -p | head -1
will work, but also output "Memory fault(coredump)".
If it's run without the | head -1
, it segfaults the entire shell.
If the typeset -T Foo_t=...
is moved outside of the namespace, the opposite happens: the typeset -p | head -1
will work with the output "Memory fault(coredump)", but just typeset -p
will work fine.
I also tested this in 1.0.0-beta.2 (since Ubuntu hasn't updated their version in apt yet...)
For the first case, the typeset -p | head -1
will take a long time but output nothing, and then crash when the | head -1
is removed. However, when the typeset -T Foo_t=...
is moved outside of the namespace, no issues at all occur.
Thanks for the report. I can reproduce this in 93u+ 2012-08-01 and ksh2020 as well.
Namespaces in general are a mess. They have many more bugs.