GitHub - VantixOps/silent-failures: Shell and Linux pitfalls that fail without failing - each lesson is a runnable proof, checked weekly in CI · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shell and Linux pitfalls that fail without failing: no red test, no error message, exit code 0 – and the problem shows up days later. Every entry here cost us real time in production.
Each lesson is a small runnable script that proves the behavior on your machine. GitHub Actions runs all of them on every push, so the badge below tells you whether each lesson still holds on current Ubuntu.
PASS means the pitfall still exists exactly as described. FAIL means the behavior changed and the lesson needs an update – please open an issue. SKIP means your environment cannot show it (for example no passwordless sudo); a skip never counts as a pass.
grep pattern file | wc -l prints 0 with status 0 both for an existing file without matches and for a file that does not exist. "0 findings" and "never measured" look the same.
Check that the input exists; test every zero against a case that must match.
With set -e -o pipefail, X=$(… | grep -c pattern) kills the script on zero matches (grep -c prints 0 and exits 1). "0 errors is good" checks die mid-run.
Treat exit 1 as a valid "no match", exit >1 as a real error.
In sudo ls /protected/file-*, your shell expands the glob. Without read access the * stays literal and ls says "No such file" although the files exist.
sudo sh -c 'ls /protected/file-*'
The rule behind all of them
A zero needs a positive control. Before you trust "0 findings", "exit 0" or "active", run the same check against something that must be found. Most of the failures above were only discovered that way.
Contributing
Found another silent failure? Open an issue or a pull request with a demo script in the same style: it must pass while the pitfall exists and fail when the behavior changes.