Skip to content

Fix zombie flag always reported as True for core files - #376

Open
devteamaegis wants to merge 3 commits into
bloomberg:mainfrom
devteamaegis:fix-psinfo-zombie-flag
Open

devteamaegis wants to merge 3 commits into
bloomberg:mainfrom
devteamaegis:fix-psinfo-zombie-flag

Conversation

@devteamaegis

Copy link
Copy Markdown

pystack core prints a "Core file information" header for every core, and its zombie: field always says True.

format_psinfo_information builds the value with bool([psinfo["zomb"]]). The flag is wrapped in a one-element list, and a non-empty list is always truthy, so a normal (non-zombie) process with zomb == 0 is reported as a zombie. This has been there since the initial commit.

The fix passes the flag to bool() directly.

The existing test_format_psinfo used zomb: 0 and expected zombie: True, so it was asserting the bug. It is now parametrized over zomb 0 and 1. Following CONTRIBUTING, the test change is the first commit and the fix the second.

Testing: I am on macOS, where the native extension can't be built, so I ran the pure-Python unit tests with a stand-in module for pystack._pystack (not part of this PR). With the test commit only, test_format_psinfo[0-False] fails; with both commits, both cases pass. Across the unit tests that can be collected that way, the set of failures is identical before and after this change (all caused by the stub's simplified is_eval_frame or by signal 7 being SIGEMT on macOS). ruff, black, and isort pass on the changed files. I did not run the integration tests, so please rely on CI for those.

No issue was opened first since the change is one line; happy to open one if you'd prefer.

This was investigated and written with an AI coding agent (Claude) working on my behalf.

test_format_psinfo passed zomb=0 and expected "zombie: True", which
encoded the current behavior rather than the intended one. Parametrize
it over both values of the flag.

Signed-off-by: devteamaegis <devteam.aegis@gmail.com>
format_psinfo_information wrapped the flag in a list before calling
bool(), so bool([0]) was always True and every core file was reported
as "zombie: True". Pass the flag to bool() directly.

Signed-off-by: devteamaegis <devteam.aegis@gmail.com>
Signed-off-by: devteamaegis <devteam.aegis@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant