Skip to content

Conversation

@B0TAxy
Copy link
Contributor

@B0TAxy B0TAxy commented Jan 18, 2026

This MR fixes a bug in the linux.environ plugin where attempting to parse the environment of a process would crash if the /proc/<pid>/environ file does not exist (e.g., kernel threads or race conditions during process termination).

Changes:

  • dissect/target/plugins/os/unix/linux/proc.py: Added an explicit .exists() check in _parse_environ before attempting to read the file. It now gracefully returns/skips instead of raising an exception.
  • tests/conftest.py: Updated the fs_linux_proc fixture to simulate a scenario where a process in /proc lacks an environ file (conditional mapping).
  • tests/.../test_environ.py:
  • Updated the expected result count from 4 to 3 (since one process is now correctly skipped due to the missing file).
  • Added a linter suppression comment for the fixture usage.

Testing:

  • Updated existing tests to verify that the plugin no longer crashes on missing files and correctly parses the remaining valid processes.

@Schamper Schamper requested a review from Horofic January 19, 2026 08:33
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