Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'typeset -p' segfaults after failing to redefine a type variable in a namespace #791

Open
dnewhall opened this issue Oct 22, 2024 · 1 comment
Labels
bug Something is not working

Comments

@dnewhall
Copy link

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.

@McDutchie McDutchie added the bug Something is not working label Oct 22, 2024
@McDutchie
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

2 participants