t1404: Harden ShellCheck fallback path — process group kill + missing warning#2923
Conversation
…arning When no timeout/gtimeout utility is available, the portable fallback wrapper now: 1. Prints a one-time warning that degraded protection is active 2. Uses process group kill (kill -- -PID) to clean up ShellCheck and all its child processes, falling back to single-process kill if the subshell isn't a process group leader 3. Simplifies the per-file timeout warning (redundant 'no timeout utility' detail already covered by the one-time warning) Addresses CodeRabbit review feedback from PR #2855 about the fallback path reopening the runaway ShellCheck risk. Closes #2900
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Thu Mar 5 15:02:03 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly hardens the ShellCheck fallback mechanism, which activates when standard Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request improves the fallback mechanism for running ShellCheck when a timeout utility isn't available. It introduces a one-time warning to inform the user about the degraded process cleanup and enhances the timeout watcher to kill the entire process group, which is a solid improvement. My review includes one suggestion to further harden the new timeout logic by avoiding error suppression, which aligns with the project's established scripting guidelines and improves debuggability.
| # Watcher: kill the process group (- prefix) to catch child processes, | ||
| # falling back to single-process kill if group kill fails (e.g., not a | ||
| # process group leader on some shells). | ||
| (sleep "$sc_timeout" && kill -- -"$sc_bg_pid" 2>/dev/null || kill "$sc_bg_pid" 2>/dev/null) & |
There was a problem hiding this comment.
While this change correctly attempts to kill the process group with a fallback, suppressing stderr for both kill commands with 2>/dev/null can hide important errors, such as "Operation not permitted". This goes against the project's general rules which advise against blanket error suppression. While removing the suppression may result in "No such process" messages in the log if the process has already completed, it ensures that actual failures in the timeout mechanism are visible for debugging.
| (sleep "$sc_timeout" && kill -- -"$sc_bg_pid" 2>/dev/null || kill "$sc_bg_pid" 2>/dev/null) & | |
| (sleep "$sc_timeout" && kill -- -"$sc_bg_pid" || kill "$sc_bg_pid") & |
References
- Avoid using '2>/dev/null' for blanket suppression of command errors in shell scripts to ensure that authentication, syntax, or system issues remain visible for debugging.



Summary
timeout/gtimeoututility is found, so users know they're running with degraded ShellCheck protectionkill -- -$PID) in the portable timeout watcher to clean up ShellCheck and all its child processes, falling back to single-process kill if the subshell isn't a process group leaderContext
CodeRabbit flagged in PR #2855 review that the fallback path (when no
timeout/gtimeoutexists) still risked runaway ShellCheck processes. PR #2855 already dropped-xand added a portable sleep-based watcher, but:kill "$sc_bg_pid"only killed the subshell, not ShellCheck's child processes — orphaned children could continue consuming resourcesVerification
bash -nsyntax check: PASSshellcheck --severity=warning: PASS (zero violations)elsebranch onlyCloses #2900