mbox series

[yocto-autobuilder-helper,0/2] janitor/ab-janitor: fix reliability and security issues

Message ID 20260403-contrib-halstead-ab-janitor-v1-0-91b4bb47c0d7@linuxfoundation.org
Headers show
Series janitor/ab-janitor: fix reliability and security issues | expand

Message

Michael Halstead April 3, 2026, 9:39 p.m. UTC
Changes:
1. Handling invalid pidfile data:
Previously, ab-janitor could enter a stuck state if the PID file contained
invalid or unexpected data. These changes improve the robustness of the
startup and exit logic, ensuring that stale or corrupted PID files don't
block the service from running or cleaning up correctly.

2. Modernizing calls and general cleanup:
The script was using older os.system() and os.chdir() patterns which
posed a shell injection risk when handling file paths.

Switched to subprocess.run() with list arguments to bypass the shell.

Replaced os.chdir() with the cwd argument in subprocess to keep the
process working directory stable.

Cleaned up technical debt including bare exceptions, variable shadowing
(file builtin), and unreachable return statements.

Corrected a misleading comment where the math (120×60) correctly
represented 2 hours, but was labeled as 30 minutes.

These changes have been tested on valkyrie and verified across the
cluster to ensure the service restarts cleanly and handles the current
autobuilder environment correctly.

---
Michael Halstead (2):
      janitor/ab-janitor: handle invalid pidfile data
      janitor/ab-janitor: modernize calls and minor cleanup

 janitor/ab-janitor | 78 +++++++++++++++++++++++++++++-------------------------
 1 file changed, 42 insertions(+), 36 deletions(-)
---
base-commit: 83d86624149fdded4fd4fe20824d391d0b9bc855
change-id: 20260403-contrib-halstead-ab-janitor-afb133fe11ea

Best regards,
--  
Michael Halstead <mhalstead@linuxfoundation.org>