Repository navigation
Fix zombie flag always reported as True for core files - #376
Open
devteamaegis wants to merge 3 commits into
Open
devteamaegis wants to merge 3 commits into
devteamaegis wants to merge 3 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pystack coreprints a "Core file information" header for every core, and itszombie:field always saysTrue.format_psinfo_informationbuilds the value withbool([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 withzomb == 0is reported as a zombie. This has been there since the initial commit.The fix passes the flag to
bool()directly.The existing
test_format_psinfousedzomb: 0and expectedzombie: True, so it was asserting the bug. It is now parametrized overzomb0 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 simplifiedis_eval_frameor 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.