fix(cowsay): resolve doctor/verify probe at /usr/games packaged path - #391
Merged
Conversation
The Debian/Ubuntu cowsay package installs its binary at /usr/games/cowsay, and /usr/games is absent from the default non-login PATH used by `bash -c`, `docker exec ... bash -c`, and cron. The doctor() probe and TEST_VERIFY_CMD used a bare `command -v cowsay`, so on a correctly-installed cowsay both falsely reported failure while dpkg-based is_installed still reported installed -- an internally inconsistent installed=yes / doctor=fail state. Both probes now try PATH first (`command -v cowsay`) and fall back to the packaged path (`[ -x /usr/games/cowsay ]`, overridable via COWSAY_GAMES_BIN for tests). The command -v branch stays first so a PATH-resolvable cowsay still wins. The unit spec previously masked the bug by faking cowsay onto PATH. It now simulates the /usr/games location via COWSAY_GAMES_BIN and asserts doctor + verify pass when cowsay exists only there, and still fail when absent from both PATH and /usr/games.
ycpss91255
enabled auto-merge (squash)
July 15, 2026 11:26
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.
The bug
The Debian/Ubuntu
cowsaypackage installs its binary at/usr/games/cowsay,and
/usr/gamesis absent from the default non-login PATH used bybash -c,docker exec ... bash -c, and cron. Both cowsay health probes used a barecommand -v cowsay:TEST_VERIFY_CMD="command -v cowsay"(consumed byverifyviamodule_default_verify->bash -c "${TEST_VERIFY_CMD}")doctor()overrideSo on a correctly-installed cowsay,
doctorandverifyFALSELY reportedfailure while dpkg-based
is_installedstill reported installed -- aninternally inconsistent
installed=yes / doctor=failstate.Scope: only
cowsayinstalls under/usr/gamesamong landed modules.cmatrix(/usr/bin/cmatrix) andfiglet(/usr/bin/figlet) are on thedefault PATH and are unaffected -- untouched.
The fix
Both probes now try PATH first, then fall back to the packaged path:
command -vbranch stays first, so a hypothetical PATH-resolvablecowsay still wins.
COWSAY_GAMES_BINoverrides the packaged path (default/usr/games/cowsay),matching the repo's established
${BIN_LINK:-/usr/local/bin/...}seamconvention, and lets unit tests inject a stub instead of writing to the
container global filesystem.
doctor()warning now names both places it checked (PATH and thepackaged path).
The unit spec previously MASKED the bug by faking
cowsayonto PATH via the_fake_binhelper, so it never exercised the real/usr/gameslocation. Itnow uses a
_fake_games_cowsayhelper +COWSAY_GAMES_BINto simulate thepackaged location and asserts doctor + verify pass when cowsay exists ONLY
there, and still fail when absent from both PATH and
/usr/games. A separatetest keeps the PATH-resolvable branch (
command -v) covered.RED-then-GREEN test evidence
RED (new tests against the unmodified module -- the "only at /usr/games"
assertions fail while the absent-case assertions pass):
GREEN (after the module fix --
just -f justfile.ci test-unit cowsay, all 54pass):
Gates (Docker, blocking foreground)
just -f justfile.ci lint-> ShellCheck OK, fish OK, Hadolint OKjust -f justfile.ci test-unit-> exit 0 (full suite)just -f justfile.ci test-integration-> exit 0 (24/24 ok)Provenance
Found by an adversarial code-review workflow.
doc/changelog/CHANGELOG.mdgains an
[Unreleased] > Fixedentry. No module METADATA changed, sodoc/module/INDEX.mdneeds no regeneration.