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

Try to avoid generating a core dump in segfault Proc test #791

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

niner
Copy link
Contributor

@niner niner commented Feb 6, 2022

The test intentionally triggers a segfault. Especially on developer's systems, this will create a core dump that will be listed by e.g. coredumpctl list which makes it harder to notice actual bug-related segfaults. We can avoid this by disabling core dumps for the process. Unfortunately there doesn't seem to be a portable way to do this. The only way to do this without changing the nature of the test (by e.g. running the process through a shell) is to use NativeCall again to call setrlimit On the bright side, if the setrlimit call fails (because e.g. it's not available on Windows), we do not need to care, as worst case we revert to the previous behaviour.

@MasterDuke17
Copy link
Contributor

This does prevent the actual core file from being created, but there is still an entry in coredumpctl list. But what about faking the segfault entirely? E.g.,

my $p = Proc.new;
use nqp;
nqp::bindattr(nqp::decont($p), Proc, q|$!exitcode|, 0); nqp::bindattr(nqp::decont($p), Proc, q|$!signal|, 11);
use Test;
throws-like { sink $p }, X::Proc::Unsuccessful;

This passes for me.

@niner
Copy link
Contributor Author

niner commented Feb 15, 2022

I think I tried that and it still created a coredump

@MasterDuke17
Copy link
Contributor

I think I tried that and it still created a coredump

Huh, doesn't for me (using arch linux).

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

Successfully merging this pull request may close these issues.

2 participants